python - 我不能使用 matplotlib

标签 python windows matplotlib pip

我不会使用 matplotlib。我用 pip 安装它,它显示在 pip 列表中,但是当我尝试导入它时,它说模块不存在。其他的工作,比如 pygame,我在安装时没有做任何不同的事情。

C:\Users\Torben>pip install matplotlib
Collecting matplotlib
  Using cached matplotlib-3.4.2-cp39-cp39-win_amd64.whl (7.1 MB)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (1.3.1)
Requirement already satisfied: numpy>=1.16 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (1.21.0)
Requirement already satisfied: cycler>=0.10 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (8.3.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: six in c:\users\torben\appdata\local\programs\python\python39\lib\site-packages (from cycler>=0.10->matplotlib) (1.16.0)
Installing collected packages: matplotlib
Successfully installed matplotlib-3.4.2

C:\Users\Torben>pip list
Package         Version

cycler          0.10.0
kiwisolver      1.3.1
matplotlib      3.4.2
numpy           1.21.0
Pillow          8.3.0
pip             21.1.3
pygame          2.0.1
pyparsing       2.4.7
python-dateutil 2.8.1
setuptools      56.0.0
six             1.16.0

C:\Users\Torben>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Torben\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
from . import _api, cbook, docstring, rcsetup
File "C:\Users\Torben\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\rcsetup.py", line 24, in <module>
from matplotlib import _api, animation, cbook
File "C:\Users\Torben\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\animation.py", line 34, in <module>
from PIL import Image
File "C:\Users\Torben\AppData\Local\Programs\Python\Python39\lib\site-packages\PIL\Image.py", line 114, in <module>
from . import _imaging as core
ImportError: DLL load failed while importing _imaging: Das angegebene Modul wurde nicht gefunden.`][1]

(last line -> DLL load failed while importing _imaging: The specified module was not found.) 

最佳答案

可能是 C++ runtime library is not installed在您的机器或环境中。试试 python -m pip install msvc-runtime

关于python - 我不能使用 matplotlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68273132/

相关文章:

python - Matplotlib 如何更改 matshow 的 figsize

python - 在 matplotlib 中绘制重叠线的建议?

python - Paramiko - sftp 客户端用于获取日志文件的最后一行

python : "de-import", "re-import", "reset import"?

windows - 如何在Windows下将Qt5构建为静态库

c++ - 无法在 Windows 对话框上显示其他 unicode 东亚语言

c# - UWP 应用程序中应使用哪个命名空间类 HttpClient?

python - BCC 未使用 python smtplib 在 gmail 上隐藏

python - Matplotlib:音频播放器光标(滑动垂直线)的动画,在 WxPython 上,位 block 传输看起来损坏

python - 使用 python 读取 .dat 文件