无法在Jupyter笔记本中导入Numpy(运行时错误:Polyfit健全性测试发出警告,很可能是由于使用了错误的加速后端)

2024-06-14 08:20:09 发布

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

我跟随https://www.firstpythonnotebook.org/(我是Jupyter的初学者,通常使用python、pip等)。到目前为止,我遵循的基本步骤是:

  1. 安装pipenv,在所需目录中创建新环境
  2. pipenv install jupyterlab
  3. pipenv install pandason this page

但是,当打开我的第一个笔记本并运行import pandas时,我收到一个错误,它似乎来自将numpy作为pandas的依赖项导入

import pandas
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas

~/.local/share/virtualenvs/test-notebook-again-duPr9W-R/lib/python3.9/site-packages/pandas/__init__.py in <module>
      9 for dependency in hard_dependencies:
     10     try:
---> 11         __import__(dependency)
     12     except ImportError as e:
     13         missing_dependencies.append(f"{dependency}: {e}")

~/.local/share/virtualenvs/test-notebook-again-duPr9W-R/lib/python3.9/site-packages/numpy/__init__.py in <module>
    284                     "that provided NumPy.\n{}\n".format(
    285                         error_message))
--> 286                 raise RuntimeError(msg)
    287     del _mac_os_check
    288 

RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned

我相信,在安装pandas时,默认情况下会在环境中安装Numpy,但这种安装似乎出了问题?我不知道什么是“加速”或“Polyfit”,老实说,试着去读它们让我觉得我有点不知所措。这里一定有一个简单的解决方案,而不是作为一个完全的初学者去理解这些东西,对吗?有人知道为什么会这样吗


Tags: installintestimportnumpypandas环境pipenv
3条回答

也出现相同错误,已尝试pipenv安装matplotlib。使用Python3.9

托马斯在评论中的链接是正确的。我从2020年7月20日开始将Python回滚到早期版本,即Python 3.8.5,并且我能够使用pip3 install pandas然后pip3 install notebook最后import pandas, numpy将pandas安装到Jupyter中

在我的Mac电脑上很有魅力

https://gist.github.com/yatsu/47bdde35e8abbe7d14bbe730342aa9e0

使用Python 3.9.0的Numpy 1.19.2

相关问题 更多 >