1、pip 升级包的时候,出现:Cannot uninstall xxx . It is a distutils installed project 的解决方法;
ERROR: Cannot uninstall ‘XXX’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
原因: 无法卸载“XXX”。这是一个distutils安装的项目,因此我们无法准确确定哪些文件属于它,这只会导致部分卸载。
解决办法: pip install XXX --upgrade --ignore-installed XXX
2、pip 虽然正常安装了,但有时候会提示你的 pip 版本过低
WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
You should consider upgrading via the ‘/usr/local/bin/python -m pip install --upgrade pip’ command.
解决办法: python -m pip install --upgrade pip
3、第三方包名称输入错误
ERROR: Could not find a version that satisfies the requirement XXX (from versions: none)
ERROR: No matching distribution found for XXX
解决办法: 第三方包名称XXX输入错误,检查名字
3、第三方包版本号输入错误
ERROR: Could not find a version that satisfies the requirement XXX==6.5 (from versions: 0.1, 0.2…)
解决办法: 很明显找不到这个版本号,而且把所有可以安装的版本号都告诉你了,我们只需要选择一个我们需要的版本号就可以,或者不指定版本号默认安装最新版本。
4、安装第三方包是报超时错误
ERROR: raise ReadTimeoutError(self._pool, None, ‘Read timed out.’)
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘pypi.org’, port=443): Read timed out.
解决办法:
1、设置加长超时时间,因为大多数地方的网络并不是完全连接不上,只是速度有点慢。这里可将默认的超时时间 --default-timeout 设置为 200s:
python -m pip --default-timeout=200 install XXX
2、若增加等待时间还未下载成功,可更换镜像源:
–index-url可以简写为-i
python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ XXX
- 清华:https://pypi.tuna.tsinghua.edu.cn/simple/
- 官方:https://pypi.org/
- 阿里云:https://mirrors.aliyun.com/pypi/simple/
- 豆瓣:https://pypi.douban.com/simple/
- 北京外国语大学 https://mirrors.bfsu.edu.cn/pypi/web/simple/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)