Python numpy Import Error Something is wrong with the numpy installation. an older

Python3的numpy更新可能会出现问题!!

这里的错误信息描述比较详细,
但是也是希望可以对症下药,
如果嫌麻烦可以直接跳到后文
根据解决方案进行尝试。

不说废话,直接看报错信息(Import Error):

错误信息描述

症状一

ImportError: Something is wrong with the numpy installation.

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

出现这个报错说明在你安装新的软件,或者更新numpy或者干什么的时候,旧的numpy没有卸载掉,两版numpy导致出现冲突。

症状二

一般这种情况下还会伴随有另一个报错:

UserWarning: loaded more than 1 DLL from .libs

进到信息中指定的.libs文件夹中会发现,确实是多了一个DLL文件,注意,这两个文件有一个你有权限删除,但是另一个你不能删除,因为python正在占用。

报错信息more

在前两个症状下进行下一步检测。
如果在未采取措施时,您卸载python再重新安装,在python的语句中import numpy。您会看到这样的信息:(不想看的主儿往后翻,朕有翻译的)

症状三

>>> import numpy
Traceback (most recent call last):
  File "D:\Python3.5.2\lib\site-packages\numpy\core\__init__.py", line 40, in 
    from . import multiarray
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Python3.5.2\lib\site-packages\numpy\__init__.py", line 142, in 
    from . import core
  File "D:\Python3.5.2\lib\site-packages\numpy\core\__init__.py", line 71, in 
    raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using D:\Python3.5.2\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

翻译一下就是,“我给你3条路,第二条路说明你的numpy库破损,想知道怎么办就往后看。”。

解决方案

如报错信息所说

  • 先卸载numpy: pip uninstall numpy
  • 再卸载numpy,直到卸载到提示信息显示,此时完全已经没有numpy了为止
  • 下载numpy:pip install numpy
  • 此时应该可用;
    若不可用,查看python安装目录下的libs文件夹,删除掉其中的另一个dll文件,应该可用。

若有效请点赞,以便更多学习者看到。

你可能感兴趣的:(Python)