简体   繁体   English

Python3,不能导入numpy

[英]Python3, can't import numpy

I am unable to import numpy.我无法导入 numpy。 Tried to uninstall and reinstall numpy by using pip and pip3.尝试使用 pip 和 pip3 卸载并重新安装 numpy。 Checked PATH.检查路径。 I am using Python3 on Windows 10.我在 Windows 10 上使用 Python3。

Below is the whole error:以下是整个错误:

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 位 (AMD64)] on win32 输入“help”、“copyright”、“credits”或“license”想要查询更多的信息。

import numpy Traceback (most recent call last): File "C:\\Python37\\lib\\site-packages\\numpy\\core__init__.py", line 40, in from .导入 numpy Traceback(最近一次调用最后一次):文件“C:\\Python37\\lib\\site-packages\\numpy\\core__init__.py”,第 40 行,来自 . import multiarray File "C:\\Python37\\lib\\site-packages\\numpy\\core\\multiarray.py", line 13, in from .导入多数组文件“C:\\Python37\\lib\\site-packages\\numpy\\core\\multiarray.py”,第 13 行,来自 . import overrides File "C:\\Python37\\lib\\site-packages\\numpy\\core\\overrides.py", line 6, in from numpy.core._multiarray_umath import ( ImportError: DLL load failed: The specified module could not be found. import overrides File "C:\\Python37\\lib\\site-packages\\numpy\\core\\overrides.py", line 6, in from numpy.core._multiarray_umath import ( ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "", line 1, in File "C:\\Python37\\lib\\site-packages\\numpy__init__.py", line 142, in from .回溯(最近一次调用):文件“”,第 1 行,在文件“C:\\Python37\\lib\\site-packages\\numpy__init__.py”中,第 142 行,从 . import core File "C:\\Python37\\lib\\site-packages\\numpy\\core__init__.py", line 71, in raise ImportError(msg) ImportError:导入核心文件“C:\\Python37\\lib\\site-packages\\numpy\\core__init__.py”,第 71 行,在 raise ImportError(msg) ImportError 中:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!重要提示:请阅读本文以获取有关如何解决此问题的建议!

Importing the multiarray numpy extension module failed.导入多阵列 numpy 扩展模块失败。 Most likely you are trying to import a failed build of numpy.很可能您正在尝试导入失败的 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.以下是如何继续: - 如果您正在使用 numpy git 存储库,请尝试git clean -xdf (删除所有不受版本控制的文件)并重建 numpy。 - If you are simply trying to use the numpy version that you have installed: your installation is broken - please reinstall numpy. - 如果您只是尝试使用已安装的 numpy 版本:您的安装已损坏 - 请重新安装 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 C:\\Python37\\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. - 如果您已经重新安装并且没有解决问题,那么: 1. 检查您使用的是您期望的 Python(您使用的是 C:\\Python37\\python.exe),并且您的目录中没有目录PATH 或 PYTHONPATH 可能会干扰您尝试使用的 Python 和 numpy 版本。 2. If (1) looks fine, you can open a new issue at https://github.com/numpy/numpy/issues . 2. 如果 (1) 看起来不错,您可以在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请包括以下详细信息: - 你如何安装 Python - 你如何安装 numpy - 你的操作系统 - 你是否安装了多个版本的 Python - 如果你是从源代码构建的,你的编译器版本,最好是构建日志

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

Original error was: DLL load failed: The specified module could not be found.原始错误是:DLL 加载失败:找不到指定的模块。

如果您想在 Windows 上获得更无缝的体验,请尝试使用 PyCharm 或 Anaconda,它们会自动为您安装 numpy/scipy,而不是标准的 Python 解释器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM