【问题标题】:Jupyter "ImportError: Unable to import required dependencies: numpy:"Jupyter“ImportError:无法导入所需的依赖项:numpy:”
【发布时间】:2021-06-02 01:33:26
【问题描述】:

我安装了 anaconda3 和 python 3.9 看起来 anaconda3 正在运行 python 3.8。 当我第一次在 anaconda3 上安装 jupyter 时,我正在工作,但我在路径/pythonpath 中做了一些更改,之后我在 jupyter 上遇到错误,但它在 Visual Studio 上工作正常。 到目前为止我已经尝试过

  1. 安装和卸载 anaconda3 和 python 3.9
  2. 安装和卸载 pandas 和 numpy

下面是 jupyter 输出的路径和 python 路径

import os
print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
print("PATH:", os.environ.get('PATH'))
*******************************************************************
PYTHONPATH: C:\Users\sachi\anaconda3\python.exe
PATH: C:\Users\sachi\anaconda3;C:\Users\sachi\anaconda3\Library\mingw-w64\bin;C:\Users\sachi\anaconda3\Library\usr\bin;C:\Users\sachi\anaconda3\Library\bin;C:\Users\sachi\anaconda3\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\users\sachi\appdata\local\programs\python\python39\lib\site-packages;C:\Python38\python.exe;C:\Users\sachi\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\sachi\AppData\Local\Programs\Python\Python39\;C:\Users\sachi\AppData\Local\Microsoft\WindowsApps;C:\Users\sachi\AppData\Local\Programs\Microsoft VS Code\bin;c:\Python39;
*******************************************************************

以下是我在 jupyter 中 import pandas as pd 时遇到的错误

ImportError                               Traceback (most recent call last)
<ipython-input-4-7dd3504c366f> in <module>
----> 1 import pandas as pd

~\pandas\__init__.py in <module>
     14 
     15 if missing_dependencies:
---> 16     raise ImportError(
     17         "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
     18     )

ImportError: Unable to import required dependencies:
numpy: 

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.8 from "C:\Users\sachi\anaconda3\python.exe"
  * The NumPy version is: "1.20.3"

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

Original error was: No module named 'numpy.core._multiarray_umath'

【问题讨论】:

标签: python numpy jupyter-notebook


【解决方案1】:

您可以先输入pip uninstall pandas,然后输入pip uninstall numpy。这两个步骤是卸载两个模块。之后,您可以输入pip install pandaspip install numpy 重新加载两个模块。我就是这样解决了我刚刚遇到的问题

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 2020-03-26
  • 1970-01-01
  • 2020-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-29
相关资源
最近更新 更多