0

我正在使用 PyCharm 试验“SPy”Spectral Python 库,我已经到了它告诉我没有找到 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.

此外,还有其他适用于 SPy 的指南/教程吗?

4

1 回答 1

1

您只需从 www.wxpython.org 下载 wxPython 即可在 Mac 上安装它。请注意他们网站上的以下通知:

注意:此安装程序未经 Apple 签名,因此默认情况下您的 Mac 会告诉您它已损坏并且不会安装它。您可以通过暂时放松系统偏好设置中的安全设置来解决此问题。在“安全和隐私”部分中,将“允许从以下位置下载的应用程序”设置为“任何地方”。

一旦我更改了这些设置,我就按照他们的指示在 Mac (Yosemite) 上安装 wxPython 没有问题。

于 2015-07-17T13:27:14.257 回答