简体   繁体   English

ModuleNotFoundError:使用“pip install numpy”后没有名为“numpy”的模块

[英]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!

  1. It is likely that there are 2 python versions(Python2.X and Python3.X) are installed in your system.您的系统中可能安装了 2 个 Python 版本(Python2.X 和 Python3.X)。
  2. 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来运行
  3. pip3 is pointing to your Python3.X, so use Python3 in your terminal to use this. pip3指向您的 Python3.X,因此Python3在终端中使用Python3来使用它。

Note:笔记:

  • To know installed libraries in your python2 use pip freeze or pip3 freeze for Python3要了解您的 python2 中已安装的库,请使用pip freezepip3 freeze for Python3
  • In case, if you are getting error for Python3 as not then this is like to be system path issues.以防万一,如果您遇到 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.

相关问题 ModuleNotFoundError:没有名为“numpy”的模块。 在 pip 安装 numpy 后获取“要求已满足”消息 - ModuleNotFoundError: No module named 'numpy'. Get “Requirement already satisfied” message after pip install numpy pip/conda 安装 numpy 后没有名为“numpy”的模块 - No module named 'numpy' after pip/conda install numpy ModuleNotFoundError: 没有命名模块<modulename> pip安装后 - ModuleNotFoundError: No module named <modulename> after pip install ModuleNotFoundError:pip安装后没有名为“请求”的模块 - ModuleNotFoundError: No module named 'requests' after pip install Pip3 和 python 不同步 | ModuleNotFoundError:没有名为“numpy”的模块` - Pip3 and python are not synchronized | ModuleNotFoundError: No module named 'numpy'` Python 3 ModuleNotFoundError:没有名为“ numpy”的模块 - Python 3 ModuleNotFoundError: No module named 'numpy' Python:“ModuleNotFoundError:没有名为‘numpy’的模块” - Python: "ModuleNotFoundError: No module named 'numpy'" ModuleNotFoundError:没有名为 numpy 的模块作为 np - ModuleNotFoundError: No module named numpy as np ModuleNotFoundError:没有名为&#39;numpy&#39;的模块; 但numpy安装 - ModuleNotFoundError: No module named 'numpy'; but numpy installed ModuleNotFoundError:在pip安装pyserial之后,没有名为“ serial”的模块 - ModuleNotFoundError: No module named 'serial' after pip install pyserial
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM