如何为 Python 安装 wxversion
How to install wxversion for Python
我正在试验 "SPy" Spectral Python 库,使用 PyCharm,我已经到了它告诉我找不到 wxversion 的地步。如何安装 wxversion?
总的来说,我是 Python 的新手,我是不是做错了什么?这是我的代码:
import matplotlib
#matplotlib.use('WX') #Replaced by editing matplotlibrc
from spectral import *
img = open_image('92AV3C.lan')
print img.__class__
print
print img
print
print img.shape
pixel = img[50,100]
print
print pixel.shape
band6 = img[:,:,5]
print
print band6.shape
print
arr = img.load()
print arr.__class__
print
print arr.info()
print
print arr.shape
view = imshow(img, (29, 19, 9))
所有内容均来自此处的 SPy 指南:http://www.spectralpython.net/user_guide.html
这是错误:
Traceback (most recent call last):
File "/Users/pkillam/PycharmProjects/untitled/SPy Experiments", line 36, in <module>
File "/Library/Python/2.7/site-packages/spectral/graphics/spypylab.py", line 1238, in imshow
import matplotlib.pyplot as plt
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 98, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/__init__.py", line 28, in pylab_setup
globals(),locals(),[backend_name],0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wxagg.py", line 6, in <module>
import backend_wx # already uses wxversion.ensureMinimal('2.8')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wx.py", line 53, in <module>
raise ImportError(missingwxversion)
ImportError: Matplotlib backend_wx and backend_wxagg require wxversion, which was not found.
此外,还有其他 guides/tutorials SPy 吗?
您只需从 www.wxpython.org 下载即可在 Mac 上安装 wxPython。请注意他们网站上的以下通知:
注意:此安装程序未由 Apple 签名,因此默认情况下您的 Mac 会告诉您它已损坏并且不会安装它。您可以通过暂时放松系统偏好设置中的安全设置来解决这个问题。在“安全和隐私”部分中,将 "Allow applications downloaded from" 设置为 "Anywhere."
我已经按照他们的指示进行操作,一旦我更改了这些设置,在 Mac (Yosemite) 上安装 wxPython 就没有问题了。
我正在试验 "SPy" Spectral Python 库,使用 PyCharm,我已经到了它告诉我找不到 wxversion 的地步。如何安装 wxversion?
总的来说,我是 Python 的新手,我是不是做错了什么?这是我的代码:
import matplotlib
#matplotlib.use('WX') #Replaced by editing matplotlibrc
from spectral import *
img = open_image('92AV3C.lan')
print img.__class__
print
print img
print
print img.shape
pixel = img[50,100]
print
print pixel.shape
band6 = img[:,:,5]
print
print band6.shape
print
arr = img.load()
print arr.__class__
print
print arr.info()
print
print arr.shape
view = imshow(img, (29, 19, 9))
所有内容均来自此处的 SPy 指南:http://www.spectralpython.net/user_guide.html
这是错误:
Traceback (most recent call last):
File "/Users/pkillam/PycharmProjects/untitled/SPy Experiments", line 36, in <module>
File "/Library/Python/2.7/site-packages/spectral/graphics/spypylab.py", line 1238, in imshow
import matplotlib.pyplot as plt
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 98, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/__init__.py", line 28, in pylab_setup
globals(),locals(),[backend_name],0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wxagg.py", line 6, in <module>
import backend_wx # already uses wxversion.ensureMinimal('2.8')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_wx.py", line 53, in <module>
raise ImportError(missingwxversion)
ImportError: Matplotlib backend_wx and backend_wxagg require wxversion, which was not found.
此外,还有其他 guides/tutorials SPy 吗?
您只需从 www.wxpython.org 下载即可在 Mac 上安装 wxPython。请注意他们网站上的以下通知:
注意:此安装程序未由 Apple 签名,因此默认情况下您的 Mac 会告诉您它已损坏并且不会安装它。您可以通过暂时放松系统偏好设置中的安全设置来解决这个问题。在“安全和隐私”部分中,将 "Allow applications downloaded from" 设置为 "Anywhere."
我已经按照他们的指示进行操作,一旦我更改了这些设置,在 Mac (Yosemite) 上安装 wxPython 就没有问题了。