背景
需要在python3.8安装pyecharts插件
我出现的问题
-
执行
pip install pyecharts==1.7.0
报错错误描述为:
Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pyecharts/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.tuna.tsinghua.edu.cn’, port=443): Max retries exceeded with url: /simple/pyecharts/ (Caused by SSLError(SSLZeroReturnError(6, ‘TLS/SSL connection has been closed (EOF) (_ssl.c:1131)’))) - skippingERROR: Could not find a version that satisfies the requirement pyecharts1.7.0 (from versions: none)
ERROR: No matching distribution found for pyecharts1.7.0 -
执行
pip list
报错
-
在另一个虚拟环境ljc中,python版本为3.11,能成功下载pyecharts
解决方法
pip的问题
对于我来说,是pip版本问题,与python版本不兼容,这个pip是在创建虚拟环境时自动下载的
最初的版本
- 卸载pip
python -m pip uninstall pip
,期间输入y进行
我这里是在bigdata虚拟环境里面卸载的
- 安装pip
python -m ensurepip --default-pip
,会自动安装一个版本,安装完大概率就能install了
这里它给我装了pip-23.0.1,然后我去执行
pip install pyecharts==1.7.0
并没有成功
接着我又把 pip-23.0.1卸载了,这时候pip是用anconda自带的(应该是吧,我不太清楚),再执行一次pip install pyecharts==1.7.0
居然成功下载了,我看了一下版本是23.2.1
误打误撞下成功了
我又打开我的另一个python3.8的虚拟环境bigdata2再试一次
卸载又重装
这次给我装了19.2.3版本的,执行pip install pyecharts==1.7.0
也是成功了
如果没成功再建一次虚拟环境再试一次吧
镜像源的问题
我在网上找解决我的问题的办法时,找到的都是与镜像源有关的,解决办法大致是安装时加上一段--trusted-host
例如: pip install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
-i 表示你从哪个镜像源下载
–trusted-host 表示信任这个镜像源
如果这个不行的话就去看看别人的帖子吧
全局设置镜像源
这里仅仅作为零碎知识的分享
- 在pip.ini文件修改
pip.ini文件目录C:\Users\10555\AppData\Roaming\pip
- 在命令行修改
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple