gpt4 book ai didi

python - 在 mac osx(雪豹)上安装 numpy

转载 作者:行者123 更新时间:2023-11-30 23:45:13 32 4
gpt4 key购买 nike

我正在尝试在我的 mac 机器上安装 numpy。无论我尝试什么,当我尝试运行我的 python 代码时,我最终都会收到此错误

 import numpy as np
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-
macosx-10.7-x86_64.egg/numpy/core/multiarray.so, 2): Symbol not found: _PyCapsule_Import
Referenced from: /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-10.7-x86_64.egg/numpy/core/multiarray.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/numpy-2.0.0.dev_26aa3cf_20110808-py2.7-macosx-
10.7-x86_64.egg/numpy/core/multiarray.so

此外,当我在终端中输入 Python 时,它会将我带到 python 2.6.1 版本。我该如何解决这个问题?

最佳答案

根据错误消息中的路径,您似乎打算为已安装的 Python 2.7 安装 Numpy。您将获得 Python 2.6。这表明您的 PATH 环境变量有问题。调整 .bash_profile 中的 PATH 变量,以便 Python 2.7 的可执行文件出现在 /usr/bin 中的系统版本之前。

关于python - 在 mac osx(雪豹)上安装 numpy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9679752/

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