遇见问题不要慌,观测报错结果信息(观测一下关键字)
以下仅罗列常见问题(其它特殊问题需要分析,具体问题具体处理)
超时
解决方案: 指定源进行加速(如果网络不稳定或设备比较老,在升级pip也可以进行指定源加速 保障不不会出问题)
通常出现在指定源的时候
解决方案: 在命令尾部需要指定源的域名地址
例如:# 运行 pip install beautifulsoup4 -i http://mirrors.aliyun.com/pypi/simple/
出现以下问题:
Collecting beautifulsoup4
The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host mirrors.aliyun.com’.
Could not find a version that satisfies the requirement beautifulsoup4 (from versions: )
No matching distribution found for beautifulsoup4
pip install beautifulsoup4 --trusted-host=mirrors.aliyun.com
关键信息:# The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored (位于 mirrors.aliyun.com 的存储库不是受信任或安全的主机,正在被忽略)
解决方案:# If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host mirrors.aliyun.com’.(如果此存储库可通过 HTTPS 访问,则建议改用 HTTPS,否则您可以忽略此警告并使用“--trusted-host mirrors.aliyun.com”允许它。)
# 因此解决命令为:
pip install beautifulsoup4 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
清华:https://pypi.tuna.tsinghua.edu.cn/simple ---域名为 pypi.tuna.tsinghua.edu.cn
豆瓣:http://pypi.douban.com/simple/ ---域名为 pypi.douban.com
阿里云:http://mirrors.aliyun.com/pypi/simple/ ---域名为 mirrors.aliyun.com
# 问题案例:
# pip install requests
Error:could not install packages due to an environmenterror…
Consider using the ‘–-user’ option or check the permissions
# 翻译:
错误:由于环境错误,无法安装软件包...
考虑使用“--user”选项或检查权限
# 解决方案:
# pip install requests --user
7️⃣0️⃣7️⃣6️⃣年8️⃣月7️⃣日0️⃣8️⃣点5️⃣分,亲亲数字连起来去Q➕一下,有笔记哦!