Installing specific package versions with pip

前端 未结 11 594
借酒劲吻你
借酒劲吻你 2020-11-22 08:38

I\'m trying to install version 1.2.2 of the MySQL_python adaptor, using a fresh virtualenv created with the --no-site-packages option. The current version shown

相关标签:
11条回答
  • 2020-11-22 08:52

    This below command worked for me

    Python version - 2.7

    package - python-jenkins

    command - $ pip install 'python-jenkins>=1.1.1'

    0 讨论(0)
  • 2020-11-22 09:03

    There are 2 ways you may install any package with version:- A). pip install -Iv package-name == version B). pip install -v package-name == version

    For A

    Here, if you're using -I option while installing(when you don't know if the package is already installed) (like 'pip install -Iv pyreadline == 2.* 'or something), you would be installing a new separate package with the same existing package having some different version.

    For B

    1. At first, you may want to check for no broken requirements. pip check

    2.and then see what's already installed by pip list

    3.if the list of the packages contain any package that you wish to install with specific version then the better option is to uninstall the package of this version first, by pip uninstall package-name

    4.And now you can go ahead to reinstall the same package with a specific version, by pip install -v package-name==version e.g. pip install -v pyreadline == 2.*

    0 讨论(0)
  • 2020-11-22 09:07

    TL;DR:

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

    First, I see two issues with what you're 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, you'll soon find out that this doesn't work. If you look at pip's installation log, or if you do a pip install -Iv MySQL_python==1.2.2 you'll 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.net's recent upgrade and PyPI's 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
    
    0 讨论(0)
  • 2020-11-22 09:07

    If you want to update to latest version and you don't know what is the latest version you can type.

    pip install MySQL_python --upgrade

    This will update the MySQL_python for latest version available, you can use for any other package version.

    0 讨论(0)
  • 2020-11-22 09:08

    I believe that if you already have a package it installed, pip will not overwrite it with another version. Use -I to ignore previous versions.

    0 讨论(0)
提交回复
热议问题