gpt4 book ai didi

python - 无法导入 python 模块(numpy、scipy、matplotlib)

转载 作者:行者123 更新时间:2023-12-02 00:43:06 29 4
gpt4 key购买 nike

我使用以下教程安装了 Python、numpy、scipy 和 matplotlib:

https://penandpants.com/2012/03/01/install-python-2/

我下载了每一个并通过双击安装。我使用的是装有 OS X Yosemite 版本 10.10.5 的 Mac

当我尝试在 IDLE 中导入 numpy、scipy 和 matplotlib 时,我收到以下错误消息:

`>>> import numpy

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper`

任何人都可以向我解释如何解决这个问题吗?

谢谢

最佳答案

使用终端并输入

sudo pip install numpy
sudo pip install matplotlib
sudo pip install scipy

对于 python3+ 使用 pip3

关于python - 无法导入 python 模块(numpy、scipy、matplotlib),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45483748/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com