原创

PIP 安装报错处理

1、subprocess-exited-with-error错误

错误信息如下(安装sh模块)

[root@bogon Python-3.9.13]# sudo pip3 install sh
Collecting sh
  Using cached sh-1.14.3.tar.gz (62 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

解决方法:更新之后,就解决上述问题了

pip3 install --upgrade setuptools

2、解决PIP安装超时

1、指定PIP安装源

例如安装 django :

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

-i 参数后面指定源

其他国内源:

豆瓣 :http://pypi.douban.com/
中国科学技术大学 :http://pypi.mirrors.ustc.edu.cn/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/

2、设置超时参数

pip install django --default-timeout=100

--default-timeout=100   设置超时时间为100秒


正文到此结束
评论

登录后才能发表评论 登录/注册

0评论
  • 还没有评论,快来抢沙发吧!