关于初次使用python pip更新PyQt5包时发生的种种问题以及最后莫名其妙的解决之总结

在使用pip安装所需要地python模块时总会碰到许多问题,比如readtimeout错误,此时存在两种解决方法:
1、使用

pip --default-timeout=100 install PyQt5 #PyQt5为模块名,时间可自由设置,500亦可

2、链接到国内开源网站,此处是我在网上找到的几种方法:
(1)单次: 可以在使用pip的时候在后面加上-i参数,指定pip源

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

(2)永久:(推荐)(windows下的解决方法)亲测有效
在自己电脑的用户文件夹中,如C:\Users\0000创建一个pip文件夹后在文件夹中创建一个名为pip的.ini文件,之后使用记事本方式打开后在其中输入
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
此后只需要正常地
pip install 模块名
即会自动通过国内镜像网站安装。

(3)此处附上找到的国内开源网站地址:

阿里云 http://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

参考原文链接:https://blog.csdn.net/yuzaipiaofei/article/details/80891108

第二种问题:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13]
网上地常规解决方法主要是在运行时加上–user参数
pip install 模块名 --user
但我尝试多次后都无法成功,观察后发现所报错的文件夹下并不存在要访问的文件,网上下载对应版本的dll文件复制粘贴到该目录下后却发现,pip每次运行都会将我bin文件夹中的d3dcompiler_47.dll文件删除后继续报环境错误,无法访问该文件(Check Permission)

此处附上另一个博主的链接:Could not install packages due to an EnvironmentError: pip install 安装时遇到环境错误的解决办法
在这里插入图片描述
在尝试多次无果后甚至将python都卸载重装后,此处是最后一次使用pip更新PyQt5,这时选择了调用
python -m pip install PyQt5 --user
却意想不到地成功了,百思不得其解,姑且记录一下。

原因可能如下所示:
在这里插入图片描述
注:pip安装出现问题时可先查看界面中出现的提示信息,大部分问题都可解决

pip list

用来查看已经安装的模块

发布了2 篇原创文章 · 获赞 1 · 访问量 93

猜你喜欢

转载自blog.csdn.net/qq_42759832/article/details/105189981