wx 脚本看不到 numpy,但是已经安装了
wx script can't see numpy, but it's installed
我有一个在 winxp 上工作的 wx 脚本(在工作中)。它已升级为 win7_64。我安装了 python2 和 wxpython(均为 32 位)。现在我的脚本不想 运行。它说 "ImportError: NumPy not found."。所以我从 numpy.org 安装了 numpy,但它没有改变任何东西。我可以导入 wx,我可以导入 numpy,但是当我尝试 运行 我的 wx 脚本时,它说没有安装 numpy。我删除并重新安装了所有内容,但没有任何改变。
怎么办?
大概是你的 numpy
太 "new" 或者你的 wxPython
太老了。
例如,组合 wxPython < 3.0 和 numpy > 1.9 不适用于 plot 模块(2.9.5 + numpy 1.8.0 和 3.0.2 + numpy 1.9.2 do 实际上有效) .
原因应该是文件 <site-packages.wx>/lib/plot.py
(2.9.5):
# Needs NumPy
try:
import numpy.oldnumeric as _Numeric
except:
msg= """
This module requires the NumPy module, which could not be
imported. It probably is not installed (it's not part of the
standard Python distribution). See the Numeric Python site
(http://numpy.scipy.org) for information on downloading source or
binaries."""
raise ImportError, "NumPy not found.\n" + msg
和 3.0.2 中使用的一样):
# Needs NumPy
try:
import numpy as np
except:
numpy.oldnumeric
不再是 numpy 1.9.2 的一部分,wx.lib.plot
是为古老的数组库开发的,你可以清楚地看到它的年代。
我有一个在 winxp 上工作的 wx 脚本(在工作中)。它已升级为 win7_64。我安装了 python2 和 wxpython(均为 32 位)。现在我的脚本不想 运行。它说 "ImportError: NumPy not found."。所以我从 numpy.org 安装了 numpy,但它没有改变任何东西。我可以导入 wx,我可以导入 numpy,但是当我尝试 运行 我的 wx 脚本时,它说没有安装 numpy。我删除并重新安装了所有内容,但没有任何改变。 怎么办?
大概是你的 numpy
太 "new" 或者你的 wxPython
太老了。
例如,组合 wxPython < 3.0 和 numpy > 1.9 不适用于 plot 模块(2.9.5 + numpy 1.8.0 和 3.0.2 + numpy 1.9.2 do 实际上有效) .
原因应该是文件 <site-packages.wx>/lib/plot.py
(2.9.5):
# Needs NumPy
try:
import numpy.oldnumeric as _Numeric
except:
msg= """
This module requires the NumPy module, which could not be
imported. It probably is not installed (it's not part of the
standard Python distribution). See the Numeric Python site
(http://numpy.scipy.org) for information on downloading source or
binaries."""
raise ImportError, "NumPy not found.\n" + msg
和 3.0.2 中使用的一样):
# Needs NumPy
try:
import numpy as np
except:
numpy.oldnumeric
不再是 numpy 1.9.2 的一部分,wx.lib.plot
是为古老的数组库开发的,你可以清楚地看到它的年代。