简体   繁体   English

运行 numpy 时遇到问题 - 关于“错误加速后端”的错误? (python、vs 代码、OS X)

[英]Having problems running numpy - error about ‘buggy accelerate backend’? (python, vs code, OS X)

Very new python learner here.这里是非常新的 Python 学习者。

Trying to build my first project, but having so many issues with numpy.试图构建我的第一个项目,但是 numpy.js 有很多问题。 When I try to run the programme, it comes back with this error:当我尝试运行该程序时,它返回此错误:

    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

I think I have everything installed correctly on VS Code, although figuring that out was a headache too.我想我已经在 VS Code 上正确安装了所有东西,尽管弄清楚这一点也很头疼。

On googling the error something about accelerate kept coming up, but I don't know how to delete or uninstall it... or even what it is.在谷歌上搜索有关加速的错误不断出现,但我不知道如何删除或卸载它......甚至它是什么。

Any tips would be so helpful!任何提示都会很有帮助!

If any more info is needed, let me know.如果需要更多信息,请告诉我。 This is my first question here.这是我在这里的第一个问题。

Thank you!谢谢! :) :)

Were you using python 3.9 when this happened?发生这种情况时,您使用的是 python 3.9 吗?

If you do not need python3.9, then I'd encourage that you specify a lower version of Python for your virtual environment by running the following command:如果您不需要python3.9,那么我鼓励您通过运行以下命令为您的虚拟环境指定较低版本的 Python:
python3.<insert lower version here> -m venv venv
For example, if you want to use python3.8:例如,如果你想使用 python3.8:
python3.8 -m venv venv
After you can install the necessary dependencies and things should work.在您可以安装必要的依赖项之后,事情应该可以工作了。

If you need(!) python3.9:如果你需要(!) python3.9:

  1. Go to venv/lib/python3.9/site-packages/numpy and open the root init .py file.转到 venv/lib/python3.9/site-packages/numpy 并打开根init .py 文件。
  2. Go to line 270 and comment out the lines 270 - 287. This is where the runtime error is being thrown for macOS darwin, and it seems to have something to do with the python environment.转到第270行并注释掉第270-287行。这是macOS darwin抛出运行时错误的地方,似乎与python环境有关。

This should also work, although I would recommend the first solution.这也应该有效,尽管我会推荐第一个解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM