matplotlib in python: updated matplotlibrc file, view library version and location, EnvironmentError: [WinError 5]

Table of contents

1. Problems encountered:

2. Reason:

3. Solution:

4. Executing pip install encountered Could not install packages due to an EnvironmentError: [WinError 5] access denied.

5. Verify and view: (library version and location)


1. Problems encountered:

When jupyter notebook uses the matplotlib library, it appears

You probably need to get an updated matplotlibrc file from

There is no problem with drawing at all, it's just uncomfortable to look at like this, so fix it.

2. Reason:

The version of the matplotlib library is too low.

3. Solution:

Update matplotlib:

1. Use the pip update that comes with python:

pip install --upgrade matplotlib

Or add a version number such as ==3.5.1 after the package to specify the version.

pip install --upgrade matplotlib==3.5.1

Since the environment variables are installed when installing python, you can directly enter windows+r into cmd to enter commands. As shown below:

2. Conda update package:

conda update matplotlib

You can also specify the version: conda install matplotlib=3.5.1
Note: The equal sign (=) is followed by the version number.

4. Executing pip install encountered Could not install packages due to an EnvironmentError: [WinError 5] access denied.

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.

 Solution:

 Add the --user option to grant permissions:

python -m pip install --upgrade pip -i https://pypi.douban.com/simple --user

I add --user directly under the update command

​ At this point the update is successful and there are no more warnings 

5. Verify and view: (library version and location)

Check the version of the matplotlib/numpy library:

Use commands to query. You need to enter the python environment first, and then query.

  • Query numpy version
import numpy

print(numpy.__version__)
或者
print(numpy.version.version)

 

  • Query the installation location of numpy
import numpy

print(numpy.__file__)

Guess you like

Origin blog.csdn.net/weixin_46474921/article/details/123783093