[在Mac上使用终端安装了Matplotlib,但在Python中使用ModuleNotFoundError

问题描述 投票:0回答:1

我在Mac上使用终端安装了matplotlib,并且已成功安装。但是,当我尝试导入matplotlib时,会产生ModuleNotFound错误。以下是我的代码和错误消息。

终端:

(myProject) bash-3.2$ python3 -m pip install -U matplotlib

查找索引:https://pypi.doubanio.com/simple要求已经是最新的:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages(3.1.3)中的matplotlib已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的python-dateutil> = 2.1(来自matplotlib)(2.8.1)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的kiwisolver> = 1.0.1(来自matplotlib)(1.1.0)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/中的pyparsing!= 2.0.4,!= 2.1.2,!= 2.1.6,> = 2.0.1 python3.8 / site-packages(来自matplotlib)(2.4.6)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的cycler> = 0.10(来自matplotlib)(0.10.0)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的numpy> = 1.11(来自matplotlib)(1.18.1)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的六个> = 1.5(来自python-dateutil> = 2.1-> matplotlib)( 1.14.0)已满足要求,跳过升级:/Users/zbao/.local/share/virtualenvs/myProject-opsBTjit/lib/python3.8/site-packages中的setuptools(来自kiwisolver> = 1.0.1-> matplotlib)(45.2.0 )

IDLE:

import matplotlib

追踪(最近通话):文件“”,第1行,位于导入matplotlibModuleNotFoundError:没有名为“ matplotlib”的模块

感谢您的帮助!如果还有其他需要,请告诉我。抱歉,我对Python还是很陌生。

我在Mac上使用终端安装了matplotlib,并且已成功安装。但是,当我尝试导入matplotlib时,会产生ModuleNotFound错误。以下是我的代码和错误...

python matplotlib nltk
1个回答
0
投票

从回溯的外观看,好像您已将matplotlib安装在virtualenv内。因此,您的选择是:

© www.soinside.com 2019 - 2024. All rights reserved.