【问题标题】:Numpy stops working after installing Tensorflow安装 Tensorflow 后 Numpy 停止工作
【发布时间】:2020-11-18 04:47:38
【问题描述】:

我最近下载了 Tensorflow,但无法正确安装。我已将其删除并使用 >pip uninstall tensorflow。

现在我想运行我的一些笔记本,但我收到一个错误:原始错误是:无法从 'numpy.core._multiarray_umath' 导入名称'_set_madvise_hugepage' (C:\Users\Brenda \anaconda3\lib\site-packages\numpy\core_multiarray_umath.cp37-win_amd64.pyd)

正如When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath' 所建议的那样,我卸载了 Numpy 并重新安装了它(我尝试了 pip install numpy –upgrade 和 pip install numpy)。错误并没有消失。

更新我的尝试

This is what I tried in my windows commandprompt
•   pip install -U numpy 
--> Requirement already up-to-date: numpy in c:\users\brenda\anaconda3\lib\site-packages (1.19.1)

•   C:\Users\Brenda>import numpy;print numpy.__version__;print numpy.__file__ 
-->  'import' is not recognized as an internal or external command,operable program or batch file.

•   C:\Users\Brenda>numpy.__version__
--> 'numpy.__version__' is not recognized as an internal or external command,operable program or batch file.

•   pip install numpy==1.8
-->     Not usefull since I’m on version 1.9

•   C:\Users\Brenda>sudo pip install numpy --upgrade --ignore-installed
--> 'sudo' is not recognized as an internal or external command, operable program or batch file.

•   C:\Users\Brenda>pip install -U numpy
--> Requirement already up-to-date: numpy in c:\users\brenda\anaconda3\lib\site-packages (1.19.1)

•   C:\Users\Brenda>pip install --target c:\users\brenda\anaconda3\lib\site-packages
--> ERROR: You must give at least one requirement to install (see "pip help install")

•   C:\Users\Brenda>pip uninstall numpy
-->     Successfully uninstalled numpy-1.19.1
C:\Users\Brenda>pip uninstall numpy
WARNING: Skipping numpy as it is not installed.

•   Typing pip list in Jupyter
--> Numpy 1.19.1

我的版本是:

  • Python3.7.6
  • NumPy 版本为:“1.19.1”

我很确定 Tensorflow 的安装导致了我的问题。

我很高兴没有 Tensorflow,我只需要 Numpy 再次工作。请帮我解决这个问题。

我的完整路径:

PATH: C:\Users\Brenda\anaconda3;C:\Users\Brenda\anaconda3\Library\mingw-w64\bin;C:\Users\Brenda\anaconda3\Library\usr\bin;C:\Users\Brenda\anaconda3\Library\bin;C:\Users\Brenda\anaconda3\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python38\Scripts;C:\Users\Brenda\anaconda3;C:\Users\Brenda\anaconda3\Library\mingw-w64\bin;C:\Users\Brenda\anaconda3\Library\usr\bin;C:\Users\Brenda\anaconda3\Library\bin;C:\Users\Brenda\anaconda3\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python38\Scripts;C:\Users\Brenda\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python38|Scripts;C:\Users\Brenda\anaconda3\lib\site-packages\numpy\.libs

完整追溯:

ImportError                               Traceback (most recent call last)
~\anaconda3\lib\site-packages\numpy\core\__init__.py in <module>
     21 try:
---> 22     from . import multiarray
     23 except ImportError as exc:

~\anaconda3\lib\site-packages\numpy\core\multiarray.py in <module>
     17 # _get_ndarray_c_version is semi-public, on purpose not added to __all__
---> 18 from ._multiarray_umath import (
     19     _fastCopyAndTranspose, _flagdict, _insert, _reconstruct, _vec_string,

ImportError: cannot import name '_set_madvise_hugepage' from 'numpy.core._multiarray_umath' (C:\Users\Brenda\anaconda3\lib\site-packages\numpy\core\_multiarray_umath.cp37-win_amd64.pyd)

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-12-6b8d439c54e0> in <module>
----> 1 import numpy as np
      2 import pandas as pd
      3 import matplotlib.pyplot as plt
      4 get_ipython().run_line_magic('matplotlib', 'inline')
      5 import seaborn as sns

~\anaconda3\lib\site-packages\numpy\__init__.py in <module>
    138     from . import _distributor_init
    139 
--> 140     from . import core
    141     from .core import *
    142     from . import compat

~\anaconda3\lib\site-packages\numpy\core\__init__.py in <module>
     46 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
     47         __version__, exc)
---> 48     raise ImportError(msg)
     49 finally:
     50     for envkey in env_added:

ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.7 from "C:\Users\Brenda\anaconda3\python.exe"
  * The NumPy version is: "1.19.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: cannot import name '_set_madvise_hugepage' from 'numpy.core._multiarray_umath' (C:\Users\Brenda\anaconda3\lib\site-packages\numpy\core\_multiarray_umath.cp37-win_amd64.pyd)

【问题讨论】:

    标签: python python-3.x numpy tensorflow


    【解决方案1】:

    似乎是一个常见的问题,试试这个帖子here.中建议的一些事情

    【讨论】:

    • 是的,这是一个很常见的问题。在这里他们还建议重新安装 Numpy。我有最新版本,但显然它没有运行。我真的不知道这里还能做什么
    • 我已经通过帖子进行了更新,所以很清楚我尝试了什么......似乎没有任何帮助。
    猜你喜欢
    • 2018-08-16
    • 1970-01-01
    • 1970-01-01
    • 2022-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-28
    相关资源
    最近更新 更多