Python——pip常见错误汇总|待完善

第一种错误:Read time out

ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
    yield
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\users\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

解决方案一:
windows输入安装命令行pip install --default-timeout=1000 pyspider(最后一个替换成自己要的库)
linux输入安装命令行pip3 install -U --timeout 1000 pyspider
解决方案二:
在目录C:\用户\Administrator\下,新建pip文件夹,使用下面的内容创建pip.ini文件:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
#这边的网址可以替换成下面任意一个,替换网址记得加/simple
#http://pypi.douban.com/
#http://pypi.hustunique.com/
#http://pypi.sdutlinux.org/
#http://pypi.mirrors.ustc.edu.cn/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn

第二种错误

 ERROR: Command errored out with exit status 10:
     command: 'c:\users\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\AppData\\Local\\Temp\\pip-install-2knnzyvi\\pycurl\\setup.py'"'"'; __file__='"'"'C:\\Users\\AppData\\Local\\Temp\\pip-install-2knnzyvi\\pycurl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\AppData\Local\Temp\pip-install-2knnzyvi\pycurl\
    Complete output (1 lines):
    Please specify --curl-dir=/path/to/built/libcurl
    ----------------------------------------
ERROR: Command errored out with exit status 10: python setup.py egg_info Check the logs for full command output.

这个错误也是在安装pyspider时遇到的
解决方案一:(这个适用于很多情况,并不只是这个错误才可以用)
第一步,安装wheel
在这里插入图片描述
第二步,https://www.lfd.uci.edu/~gohlke/pythonlibs/ 去这里下载pycurl文件(按自己所需下载,直接ctrl F找)
在这里插入图片描述
第三步,在命令窗口直接输入pip install 下载的包的路径和包名
在这里插入图片描述
第四步,输入最开始的安装命令(这里就没有错误了)
在这里插入图片描述
在这里插入图片描述

第三种错误 :Lock error

    TimeoutError: Lock error: Matplotlib failed to acquire the following lock file:
        C:\Users\郑玉婷\.matplotlib\fontlist-v310.json.matplotlib-lock
    This maybe due to another process holding this lock file.  If you are sure no
    other Matplotlib process is running, remove this file and try again.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

大功告成!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章