When attempting to install a specific version of a package using pip, users may encounter challenges when the requested version is not the latest available. This article explores a solution to this issue.
Problem:
A user is attempting to install version 1.2.2 of the MySQL_python package in a fresh virtualenv with the --no-site-packages option. However, despite specifying the version using pip install MySQL_python==1.2.2, the installed package is still shown as MySQL_python-1.2.3-py2.6.egg-info in the site packages.
Solution:
To force pip to install a specific package version, even if it's not the latest, use the --force-reinstall -v options. The --force-reinstall option ensures that the package is reinstalled, even if it's already up-to-date, and the -v option provides verbose output for additional information.
pip install --force-reinstall -v "MySQL_python==1.2.2"
Alternative Option:
In some cases, using the --ignore-installed -v options can be effective. The --ignore-installed option instructs pip to ignore existing installed packages and overwrite them with the specified version.
pip install -Iv MySQL_python==1.2.2
Additional Considerations:
Conclusion:
By utilizing the --force-reinstall -v or --ignore-installed -v options, users can successfully install specific package versions using pip, even if they are not the latest available.
The above is the detailed content of How to Force Pip to Install a Specific, Non-Latest Package Version?. For more information, please follow other related articles on the PHP Chinese website!