首页 > 解决方案 > Jupyter Notebook - 检索 numpy 的错误

问题描述

这是尝试将 pandas 导入为 pd 时返回的错误消息


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

/usr/lib/python3/dist-packages/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.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.9 from "/usr/bin/python3.9",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.4" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     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

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

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: No module named 'numpy.core._multiarray_umath'

我正在运行 Ubuntu 20.04 Python3.9

我检查过 Python3.9 运行正常。我已经卸载并安装了 numpy 和 anaconda 我已经尝试创建和运行一个虚拟环境来使用 jupyter

我不知道还能做什么,或者我的问题出在哪里。对此的任何帮助将不胜感激。

标签: pandasnumpyjupyter-notebook

解决方案


所以我解决了我的问题。

在 Jupyter notebook 中打开新 notebook 时,会提示您打开 Python3 notebook 或 Python3.9.0 64 位 notebook。虽然 Python3.9.0 64 位是最新版本,而且我已经下载了一个,但它不是我安装的。打开 Python3 书时,我可以很好地导入熊猫(我没有收到关于无法打开 numpy 的错误消息)


推荐阅读