python toolchain package management tools pip

Installation

The mac can be employed brew, easy_install (python own) or the like is mounted.

May be employed at centos yum, easy_install like installed.

But the above two methods are multiple python environments on the system, it will cause confusion. Not so good for the development of python version installed pip, then take the following way, when installation is designated python version.

Recommended Installation

# 默认安装脚本,下载速度较慢
curl https://bootstrap.pypa.io/get-pip.py | /usr/bin/python

# 下载速度较快
curl http://qinius.echosoul.cn/get-pip.py | /usr/bin/python

Usage

pip command script commands may be used alone as such pip list, may be used with the python interpreterpython -m pip list

The latter benefit is under way in different environments python, pip on their own third-party package file to install the module to a specified folder python

  • Installation Module

    • pip install packageName Download and install the latest version
    • pip install packageName==1.0.0Download and install the specified version
    • pip install 'packageName>=1.0.0 Download and install at least one version of the package
    • pip install url Installation resources from the specified URL
    • pip install path Specify a local installation location
    • pip install --find-links=url Download and install from the specified url
    • pip install --find-links=path Download and install from the designated path
    • pip install --upgrade packageName Update expired a module already installed
  • On the demand file installation module

    • pip freeze > requirements.txt The current management module pip information stored into text file
    • pip install -r requirements.txt Installation depends from a text file module
  • Uninstall

    • pip uninstall
  • download

    • pip download
  • Seek

    • pip search
  • View module information

    • pip show
  • View pip manage which modules

    • pip list
    • pip list --outdated View module expired

Mirror accelerate

The default pip official source in the country is very slow, the use of some domestic sources.

Command line

Parameter --index-urlspecifies mirror source

pip install requests [-i|--index-url] https://pypi.tuna.tsinghua.edu.cn/simple

Profiles way

  1. Create a directory ~/.pip/

  2. Profiles

    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    

Guess you like

Origin www.cnblogs.com/hiyang/p/12631533.html
Recommended