如何在Python Shell中导入NumPy
我尝试在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 Shell中导入NumPy 的全部内容, 来源链接: utcz.com/qa/402791.html