Problems encountered by pip installation library

Win+r cmd opens the command line and enters pip install numpy to install the python library

What should I do if the download speed of pip installation Python library is too slow?

1. We can change the download source, the fastest and easiest way is to add parameters when downloading

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple library name

The source of Tsinghua University is used here, of course, other sources can also be selected, for example:

Alibaba Cloud: http://mirrors.aliyun.com/pypi/simple/  

Douban: http://pypi.douban.com/simple/

……

2. If you don't want to copy the parameter installation every time, here is also a once-for-all solution:

Find the user directory of Windows, and create a pip.ini folder in the user directory, for example: C:\Users\xxx\pip.ini Linux is in /home/hadoop/.pip/pip.conf

Enter the following:

[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/

Here is the download source of Alibaba Cloud. If you want to change the source, just change the url.

Question 2: An error occurred while installing the package

ERROR: Cannot unpack file /tmp/pip-unpack-Bi5DIM/simple.html (downloaded from /tmp/pip-req-build-EOP5t7, content-type: text/html); cannot detect archive format
ERROR: Cannot determine archive format of /tmp/pip-req-build-EOP5t7

Solution: Use the command pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn to solve the problem

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 包名

Guess you like

Origin blog.csdn.net/Lorrey_/article/details/124505993