pip install 各种包会遇到的问题ERROR解决

(Mac)pycharm下载包

pip install 各种包会遇到的问题ERROR: Exception: Traceback (most recent call last):

今天在pycharm下载包,大部分都下载好了就black没有下载成功,它提示去终端下载,然后我去了,输入

pip install black

然后就报错了

ERROR: Exception:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py”, line 425, in _error_catcher
yield
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py”, line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py”, line 457, in read
n = self.readinto(b)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py”, line 501, in readinto
n = self.fp.readinto(b)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py”, line 589, in readinto
return self._sock.recv_into(b)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”, line 1071, in recv_into
return self.read(nbytes, buffer)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”, line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

接着我去网上一查说是忘记家sudo 权限问题,然后我加了,还是一样的

sudo pip install black

输入电脑密码,然后出了个提示:

WARNING: The directory ‘/Users/a111/Library/Caches/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

我以为会下载好,结果还是是失败了,都是有些人可以成功
pip install 各种包会遇到的问题ERROR解决
最后我找到了解决方案在下载包后面加镜像地址

pip install black -i https://pypi.tuna.tsinghua.edu.cn/simple
我这里用的是清华的镜像很快

pip install 各种包会遇到的问题ERROR解决

完成