赞
踩
目录
4、执行pip install遇到 Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。
jupyter notebook使用matplotlib库时,出现
You probably need to get an updated matplotlibrc file from
绘图完全没有问题,只是这样看着实在难受,所以解决一下。
matplotlib库的版本过低造成的。
对matplotlib进行更新:
1、使用python自带的pip更新:
pip install --upgrade matplotlib
或者在包后面加==3.5.1等等版本号来指定版本。
pip install --upgrade matplotlib==3.5.1
由于安装python时安装了环境变量,所以可以直接windows+r进入cmd输入命令。如下图:
2、conda更新包:
conda update matplotlib
同样可以指定版本:conda install matplotlib=3.5.1
注意:等号(=)后面是版本号。
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'C:\\Users\\86157\\AppData\\Local\\Temp\\pip-uninstall-0jdje1cp\\matplotlib\\backends\\_backend_agg.cp37-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
解决办法:
添加--user选项赋予权限:
python -m pip install --upgrade pip -i https://pypi.douban.com/simple --user
我这里直接在更新命令下添加--user
此时更新成功,不再有警告
查看matplotlib/numpy库的版本:
使用命令进行查询。需要首先进入python环境,然后在进行查询。
- import numpy
-
- print(numpy.__version__)
- 或者
- print(numpy.version.version)
- import numpy
-
- print(numpy.__file__)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。