[英]ModuleNotFoundError: No module named 'numpy' after using 'pip install numpy'
I tried installing numpy using the command 'pip install numpy'
and ran 'import numpy'
but I received the error ModuleNotFoundError: No module named 'numpy'
when I tried to re-run the code.我尝试使用命令
'pip install numpy'
并运行'import numpy'
但是当我尝试重新运行代码时收到错误ModuleNotFoundError: No module named 'numpy'
。 After reading similar questions on SO, I ran pip3 install numpy
, but since i already installed it, I received the message Requirement already satisfied
.在阅读了关于 SO 的类似问题后,我运行了
pip3 install numpy
,但是由于我已经安装了它,我收到了消息Requirement already satisfied
pip3 install numpy
。
NOTE: I have read other similar questions on SO, but none of them solve my problem.注意:我已经阅读了关于 SO 的其他类似问题,但没有一个能解决我的问题。
Possible solution for future readers:未来读者的可能解决方案:
Like @Sampath mentioned in his answer, I had two versions of python installed.就像他的回答中提到的@Sampath 一样,我安装了两个版本的 python。 To solve the issue, I manually deleted all the installation files of the older version.
为了解决这个问题,我手动删除了旧版本的所有安装文件。
Welcome to SO!欢迎来到 SO!
pip
is likely pointing to your Python2.X and so if you want to used libraries installed in this version ===> use python
to run pip
很可能指向你的 Python2.X,所以如果你想使用安装在这个版本中的库 ===> 使用python
来运行pip3
is pointing to your Python3.X, so use Python3
in your terminal to use this. pip3
指向您的 Python3.X,因此Python3
在终端中使用Python3
来使用它。 Note:笔记:
pip freeze
or pip3 freeze
for Python3pip freeze
或pip3 freeze
for Python3 If you are still having trouble, you learn more about Anaconda-Python
which has a curated list of steps and guidelines that are easy for beginners too.如果您仍然遇到问题,您可以了解有关
Anaconda-Python
更多信息,其中有一个对初学者也很容易的步骤和指南的精选列表。 Hope this helps!希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.