python - 无法在 Jupyter 笔记本中导入 Numpy(RuntimeError: Polyfit sanity test 发出警告,很可能是由于使用了有问题的 Accelerate 后端)
问题描述
我正在关注https://www.firstpythonnotebook.org/(我是使用 Jupyter 的初学者,通常使用 python、pip 等)。基本上我到目前为止所遵循的步骤是:
- 安装 pipenv,在所需目录中创建新环境
pipenv install jupyterlab
pipenv install pandas
(在这个页面上)
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,但是这个安装似乎出了点问题?我不知道“Accelerate”或“Polyfit”是什么,老实说,试图阅读它们是什么感觉就像我在头上一样。这里一定有一个比作为一个初学者来理解这些东西更简单的解决方案,对吧?任何人都知道为什么会发生这种情况?
解决方案
在我的 Mac 上工作就像一个魅力。
https://gist.github.com/yatsu/47bdde35e8abbe7d14bbe730342aa9e0
Numpy 1.19.2 和 Python 3.9.0
推荐阅读
- angular - 使用 rxjs 运算符可以获得倒数第二个值
- python-3.x - 我的代码在在线编译器上运行良好,但在 GEG 空闲时出现 EOF 错误
- docker - 创建 docker 容器时出现错误消息
- azure - while循环中的Powershell函数第一次不输出结果,但第二次输出,两次
- f# - 我可以在 F# 的有区别的联合中直接使用代表吗?
- c++ - 在 Pybind11 中使用自动转换
- android - 从 Listview (Fragment) 的 onClick 方法启动 Activity
- c# - 在一个查询中执行 2 次搜索
- java - 填充和打印个人 LinkedList 复制的元素
- c - 将字符串转换为 Int 并再次返回字符串 C