python – Installing specific package versions with pip

python – Installing specific package versions with pip

TL;DR:

  • pip install -Iv (i.e. pip install -Iv MySQL_python==1.2.2)

First, I see two issues with what youre trying to do. Since you already have an installed version, you should either uninstall the current existing driver or use pip install -I MySQL_python==1.2.2

However, youll soon find out that this doesnt work. If you look at pips installation log, or if you do a pip install -Iv MySQL_python==1.2.2 youll find that the PyPI URL link does not work for MySQL_python v1.2.2. You can verify this here: http://pypi.python.org/pypi/MySQL-python/1.2.2

The download link 404s and the fallback URL links are re-directing infinitely due to sourceforge.nets recent upgrade and PyPIs stale URL.

So to properly install the driver, you can follow these steps:

pip uninstall MySQL_python
pip install -Iv http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download

You can even use a version range with pip install command. Something like this:

pip install stevedore>=1.3.0,<1.4.0

And if the package is already installed and you want to downgrade it add --force-reinstall like this:

pip install stevedore>=1.3.0,<1.4.0 --force-reinstall

python – Installing specific package versions with pip

One way, as suggested in this post, is to mention version in pip as:

pip install -Iv MySQL_python==1.2.2

i.e. Use == and mention the version number to install only that version. -I, --ignore-installed ignores already installed packages.

Leave a Reply

Your email address will not be published. Required fields are marked *