Jupyter“导入错误:无法导入所需的依赖项:numpy:”

时间:2021-06-02 01:33:26

标签: python numpy jupyter-notebook

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

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

下面是jupyter的path和python path输出

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'

0 个答案:

没有答案