我曾尝试在 Python 中导入 NumPy,但没有成功:
>>> import numpy as np
x=np.array([[7,8,5],[3,5,7]],np.int32)
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import numpy as np
File "C:\Python27\lib\numpy\__init__.py", line 127, in <module>
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your Python interpreter from there.
我该如何解决这个问题?
最佳答案
该消息是不言自明的;当你调用 Python 时,你的工作目录不应该是 NumPy 源目录;应该安装 NumPy,你的工作目录应该不是它所在的目录。
关于python - 如何在 Python shell 中导入 NumPy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11906575/