As of pip 1.3, there is a pip show
command.
$ pip show Jinja2
---
Name: Jinja2
Version: 2.7.3
Location: /path/to/virtualenv/lib/python2.7/site-packages
Requires: markupsafe
In older versions, pip freeze
and grep
should do the job nicely.
$ pip freeze | grep Jinja2
Jinja2==2.7.3
You can look up the package on the Python Package Index and scroll down to the "Meta" section in the left sidebar. This shows the Python version required by the package. As you do not specify the package you are looking for, I will use numpy as an example. For the current version of numpy, the following information is listed:
Requires: Python >=3.7
Therefore, you need Python 3.7 or higher to install this version of numpy.
If you are using an older version of Python and need the most recent version of the package that is compatible with that version, you can go to the release history (the second link at the top of the sidebar) and try different versions, scrolling down to the "Meta" section for every version. This is still a manual process, but less work than trying to install every single version.
Note: often, support for older versions is dropped in larger updates (so when either the first or second version number is updated), so you can skip small updates to speed up your search process.
For example, using this process, you can deduce that numpy 1.19.5 is the latest version to support Python 3.6, and numpy 1.16.6 is the latest version to support Python 2.7. At the top of the page, the command to install an older version of a package is shown, for example: pip install numpy==1.16.6
.
Best Answer
You can do this:
or: