Windows installation Python third-party library avoiding pit guide

Use cmd command python -m pip install --upgrade pip update failed

Solution: let PIP source use domestic mirror

Commonly used pip source:
Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple Alibaba
Cloud
: http://mirrors.aliyun.com/pypi/simple/Douban: http://pypi.douban.com/ simple /

更新 pip
python -m pip install --upgrade pip -i https://pypi.douban.com/simple

Use pip sources to install and update third-party libraries

Temporary use method
When entering on the command line, add -i and mirror address to the original command.

Take installing numpy library as an example
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy

Permanent use (replace with domestic source)

  1. Create pip folder under C: / users / administrator file
  2. Create a text file named pip in the pip folder ( suffix name changed from ".txt" to ".ini" )
  3. Enter the following code in C: /users/administrator/pip/pip.ini file and save
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
    [install]
    trusted-host = pypi.tuna.tsinghua.edu.cn

  4. You
    can quickly install the jieba library by directly typing in the cmd command line and typing pip install jieba
Published 4 original articles · received 1 · views 128

Guess you like

Origin blog.csdn.net/qq_34385466/article/details/104324445