How to know which version in use of a particular package installed via pip?

3

I'm starting to program in python and I've been trying to use best practices: virtualenv, pip, etc. One of the packages I have used (pelican) has different help pages for each version. How do I know which version I am using? I installed it with the command:

pip install pelican

But I no longer remember which version was downloaded. Is there anything to see?

Thank you!

    
asked by anonymous 14.06.2015 / 17:21

4 answers

3

While writing the question, I remembered the answer:

pip freeze

It returns the following:

pelican==3.5.0

I had used the command to create the requirements.txt file, which is another place where you can look.

    
14.06.2015 / 17:21
2

Only one alternative, for pip 1.3 or higher you can use the command show :

pip show pelican

Source SOEn - Find which version of package is installed with pip

    
14.06.2015 / 17:28
1

It is interesting that you save in a file the list of all installed packages of your project, as you already know using the pip freeze command the packages and their versions are presented.

To save direct to a file simply use:

pip freeze > requerimentos.txt

To install the packages listed, simply use the command:

pip install -r requirimentos.txt
    
14.06.2015 / 19:19
1

To see the installed version of a specific package use:

pip show pelican

This command will show the installed version and other information about the package.

To list the version of all installed packages use:

pip freeze

This command will produce an output like this:

blinker==1.3
docutils==0.12
feedgenerator==1.7
Jinja2==2.7.3
MarkupSafe==0.23
pelican==3.5.0
Pygments==2.0.2
python-dateutil==2.4.2
pytz==2015.4
six==1.9.0
Unidecode==0.4.18

It is common to use pip freeze to generate a requirements.txt file, since the format generated by the output is compatible with pip install -r

Also worth mentioning is the

pip list

That produces an output like the example below:

blinker (1.3)
docutils (0.12)
feedgenerator (1.7)
Jinja2 (2.7.3)
MarkupSafe (0.23)
pelican (3.5.0)
pip (7.0.3)
Pygments (2.0.2)
python-dateutil (2.4.2)
pytz (2015.4)
setuptools (17.1.1)
six (1.9.0)
Unidecode (0.4.18)

That's not so different from pip freeze, its advantage is to use along with the -o option:

pip list -o

That will list only the paces that have updates available along with the installed version and the available version, in the format below:

pelican (Current: 3.4.0 Latest: 3.5.0 [wheel])
    
14.06.2015 / 21:47