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

2024-09-30 12:35:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我安装了anaconda3和python3.9 看起来anaconda3正在使用python 3.8运行。 当我第一次在anaconda3上安装jupyter时,我的jupyter工作正常,但我在path/pythonpath中做了一些更改,之后我在jupyter上出现了错误,但在visual studio上工作正常。 到目前为止我已经试过了

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

下面是jupyter对path和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'

Tags: theimportnumpypandasbinoswindowslocal

热门问题