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

How to Install Specific Python Package Versions with Pip?

DDD
Release: 2024-12-19 02:50:14
Original
712 people have browsed it

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"
Copy after login

Original Solution:

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

pip install -Iv "MySQL_python==1.2.2"
Copy after login

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
    Copy after login
  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"
    Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template