Python Numpy已安装但仍然出现错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/54715835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:30:16  来源:igfitidea点击:

Numpy is installed but still getting error

pythonnumpytensorflow

提问by Nishant

I am trying to run jupyter notebook and getting following error. I am using Win 7 with anaconda python 3.7.

我正在尝试运行 jupyter notebook 并出现以下错误。我正在将 Win 7 与 anaconda python 3.7 一起使用。

ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['c:\users\paperspace\anaconda3\envs\tensorflow10\lib\site-packages\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

ImportError: numpy 安装有问题。在导入时,我们在 ['c:\users\paperspace\anaconda3\envs\tensorflow10\lib\site-packages\numpy'] 中检测到旧版本的 numpy。解决此问题的一种方法是反复卸载 numpy 直到找不到为止,然后重新安装此版本。

I have followed the steps mentioned in the error but still not working.

我已按照错误中提到的步骤操作,但仍然无法正常工作。

回答by Sundeep Pidugu

Run

pip3 uninstall numpy

pip3 uninstall numpy

until you receive a message stating no files available with numpy to uninstalland then you can freshly install numpy using

直到您收到一条消息no files available with numpy to uninstall,然后您可以使用新安装 numpy

pip install numpy

pip install numpy

and that will fix the issue.

这将解决问题。

回答by KK2491

I was getting the error when I was trying to use Keras. This can be fixed by removing the numpypackage continuously by running pip3 uninstall numpy. And checking the successful un-installation by opening a python terminal and importing numpypackage.

我在尝试使用 Keras 时遇到错误。这可以numpy通过运行pip3 uninstall numpy. 并通过打开 python 终端并导入numpy包来检查是否成功卸载。

回答by anthony .bm

Remove the folder numpy and reinstall numpy. work for me. Code below

删除文件夹 numpy 并重新安装 numpy。为我工作。下面的代码

rm -rf ~/.local/lib/python3.6/site-packages/numpy
pip install numpy

回答by Siddharth167

Use conda update --all

使用conda update --all

This works.

这有效。

回答by Hertzel Guinness

per https://github.com/numpy/numpy/issues/12976, tried conda update -c defaults numpyand it worked. YMMV...

根据https://github.com/numpy/numpy/issues/12976,尝试过conda update -c defaults numpy并且有效。天啊...

回答by John Melody Melissa

This Means a Duplicated. Try pip uninstall numpy or pip3 uninstall numpythen sudo apt-get install python3-numpy

这意味着重复。pip uninstall numpy or pip3 uninstall numpy那就试试sudo apt-get install python3-numpy

FOR (DEBIAN DIST)

对于(DEBIAN DIST)

回答by JasonWayne

Besides all the other answers, you may try something like

除了所有其他答案之外,您还可以尝试类似的方法

yum erase numpy

is you intalled some python library using yum installor apt-get install

您是否使用yum install或安装了一些python库apt-get install

回答by Tessaracter

Apparently, multiple versions of numpyis installed on the computer in the same python virtual environment. This is strange and never happened with any other packages. Uninstall all the packages and install numpyagain. This should solve the problem.

显然,numpy在同一python虚拟环境中的计算机上安装了多个版本。这很奇怪,任何其他软件包从未发生过。卸载所有软件包并numpy重新安装。这应该可以解决问题。

Use pipto uninstall.

使用pip卸载。

pip3 uninstall numpy 
# or
python3 -m pip uninstall numpy

Then install again. Preferably with the exact version number.

然后重新安装。最好有确切的版本号。

pip3 install numpy==1.18.4

I had to uninstall numpythrice. Until I got the message WARNING: Skipping numpy as it is not installed.

我不得不卸载numpy三次。直到我收到消息WARNING: Skipping numpy as it is not installed.

回答by Brian Schneider

For me it was about the consoles used.

对我来说,这与使用的控制台有关。

My cygwin terminal - NOPE, dos - NOPE, but console opened from Anaconda or Spyder etc... all commands (pip install etc) worked.

我的 cygwin 终端 - NOPE,dos - NOPE,但控制台从 Anaconda 或 Spyder 等打开......所有命令(pip install 等)都有效。