Installing Specific Package Versions with Pip
When attempting to install a specific package version, such as MySQL_python 1.2.2, using pip, you may encounter issues due to an existing installed version or outdated PyPI links.
To override the installed package and install the desired version, use the --ignore-installed (-I) option in conjunction with -v for verbosity:
pip install -Iv MySQL_python==1.2.2
Note: This approach may result in errors if the PyPI download link for the specified version is broken.
If you encounter 404 errors or infinite redirects, you can manually download the package from a stable source (e.g., SourceForge) and install it directly:
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
Updated (December 28, 2022):
Pip now offers a simplified method to reinstall packages, even if they are already up-to-date:
pip install --force-reinstall -v MySQL_python==1.2.2
This replaces the -I option and provides additional control with verbosity levels (-vv/-vvv).
Remember, while ignoring currently installed packages (-I or --force-reinstall) may be useful for installing specific versions, caution should be exercised to avoid potential package inconsistencies.
The above is the detailed content of How Can I Install Specific Package Versions with Pip, Even if They're Already Installed?. For more information, please follow other related articles on the PHP Chinese website!