In my setup.py
file, I've specified a few libraries needed to run my project:
setup( # ... install_requires = [ 'django-pipeline', 'south' ] )
How can I specify required versions of these libraries?
As the setup.py file is installed via pip (and pip itself is run by the python interpreter) it is not possible to specify which Python version to use in the setup.py file.
The best technique is to define __version__ in your product code, then import it into setup.py from there. This gives you a value you can read in your running module, and have only one place to define it. The values in setup.py are not installed, and setup.py doesn't stick around after installation.
How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .
The items listed in setup_requires get implicitly installed whenever you execute the setup.py but one of the common ways that the setup.py is executed is via another tool, such as pip , who is already managing dependencies.
I'm not sure about buildout, however, for setuptools/distribute, you specify version info with the comparison operators (like ==
, >=
, or <=
).
For example:
install_requires = ['django-pipeline==1.1.22', 'south>=0.7']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With