Home >Backend Development >Python Tutorial >How to Install Specific Python Package Versions with Pip?

How to Install Specific Python Package Versions with Pip?

DDD
DDDOriginal
2024-12-19 02:50:14788browse

How to Install Specific Python Package Versions with Pip?

Installing Specific Package Versions with Pip

Problem:

Installing specific package versions through Pip can be challenging. For instance, attempting to install MySQL_python version 1.2.2 may result in the latest version (1.2.3) being installed instead. This can be frustrating when compatibility with specific versions is crucial.

Solution:

Updated Solution (2022-12-28):

For the most up-to-date solution, use the following command:

pip install --force-reinstall -v "MySQL_python==1.2.2"

Original Solution:

Previously, the recommended solution involved using -I (--ignore-installed):

pip install -Iv "MySQL_python==1.2.2"

However, this option may not work due to a broken PyPI URL link for MySQL_python v1.2.2. To resolve this issue, follow these steps:

  1. Uninstall the existing MySQL_python package:

    pip uninstall MySQL_python
  2. Download the specific package version from the correct URL:

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

This process will ensure that the desired package version is installed on your system.

The above is the detailed content of How to Install Specific Python Package Versions with Pip?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn