Secret Recipes of the Python Ninja
上QQ阅读APP看书,第一时间看更新

How to do it...

  1. Use pip to pull the latest version of the package directly from PyPI:
      $ pip install <package_name>
  1. Alternately, a specific version of the package can be downloaded:
      $ pip install <package_name>==1.2.2

Here is an example of downgrading pygments from our earlier install in pipenv:

  1. As a final option, a minimum version of a package can be downloaded; this is common when a package has a significant change between versions:
      $ pip install "<package_name> >= 1.1"
  1. If a PyPI package has a wheel file available, pip will automatically download the wheel; otherwise, it will pull the source code and compile it.
      $ pip install <some_package>
  1. To install a local wheel file, provide the full path to the file:
      $ pip install /local_files/SomePackage-1.2-py2.py3-none-any.whl