Install wxPython 2.8 (For Ride) on OSX “El Capitan

2020-05-18 04:11发布

问题:

I'm trying to install wxPython 2.8 unicode version, to be able to use robotframework-ride.

So far the installer downloaded from the site failed with an error saying "There was no software to install"

And using Brew installs the 3.0 version, that is not compatible with ride.

I would appreciate some help on this issue, I'm a new Mac user (just got given one at the office, and have to use it for my project) , and this is the only thing so far that I haven't been able to solve at all.

The version I need to install is: wxPython2.8-osx-unicode-2.8.12.1-universal-py2.7

The installer doesn't seem to work at all with this version of OSX.

Thank you in advace.

回答1:

Actually wxPython 3.0 can work with RIDE. here are my pip list:

decorator (4.0.6)
docutils (0.12)
ecdsa (0.13)
Flask (0.10.1)
gunicorn (19.0.0)
itsdangerous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
paramiko (1.16.0)
pip (7.1.2)
pycrypto (2.6.1)
robotframework (3.0)
robotframework-databaselibrary (0.6)
robotframework-rammbock (0.4.0.1)
robotframework-requests (0.4.0)
robotframework-ride (1.5.1)
robotframework-selenium2library (1.7.4)
robotframework-sshlibrary (2.1.2)
selenium (2.48.0)
setuptools (18.7.1)
vboxapi (1.0)
Werkzeug (0.9.6)
wheel (0.26.0)
wxPython (3.0.2.0)
wxPython-common (3.0.2.0)

Pip cannot find wxPython to install. use homebrew instead:

$homebrew install wxPython (will install 3.0.2.0)
$pip install robotframework (will install 3.0)
$pip install robotframework-ride (will install 1.5.1)

Allow 3.0 check to '~/homebrew/lib/python2.7/site-packages/robotide/__init__.py':

if sys.platform == 'darwin':
    supported_versions.append("2.9")
    supported_versions.append("3.0")

Remove ~/.robotframework before start ride.py to void RIDE crashing when loading last-opened folder. Make a short shell script ~/homebrew/bin/ride:

#!/bin/sh
rm -rf ~/.robotframework
~/homebrew/bin/ride.py

and chmod +x ~/homebrew/bin/ride. From shell enter 'ride', all should work well -- just reopen your test suite each time.



回答2:

I ran into the same error:

$ sudo installer -pkg /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg/ -target /
installer: Package name is wxPython2.9-osx-cocoa-py2.7
installer: Installing at base path /
2015-10-19 11:27:48.417 installer[875:22541] Package /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg uses a deprecated pre-10.2 format (or uses a newer format but is invalid).
installer: The install failed (The Installer could not install the software because there was no software found to install.)

As you may know, on OS X, RIDE supports both wxPython 2.8 and 2.9, and that's why I'm using v2.9 here:

try:
    import wxversion
    from wxversion import VersionError
    if sys.platform == 'darwin': # CAN NOT IMPORT IS_MAC AS THERE IS A wx IMPORT
        wxversion.select(['2.8', '2.9'])
    else:
        wxversion.select('2.8')
except ImportError:
    print "wxPython not found."

Although wxmac formula can be used to install wxPython 2.9.5.0, but on OS X 10.11 El Capitan, you'll encounter the following error reported in #16329 while building wxWidgets.

So, we have to build it from (modified) source code:

  1. Install Xcode, and download wxPython-src-2.9.5.0.tar.bz2.

  2. Extract the tarball and replace #include <WebKit/WebKit.h> (in src/osx/webview_webkit.mm) with #include <WebKit/WebKitLegacy.h>.

Then follow the instructions described in wxmac formula to build and install wxPython:

$ cd wxPython-src-2.9.5.0
$ PREFIX=/usr/local
$ ./configure --prefix=$PREFIX --enable-shared --enable-monolithic --enable-unicode --enable-std_string --enable-display --with-opengl --with-osx_cocoa --with-libjpeg --with-libtiff --with-libpng --with-zlib --enable-dnd --enable-clipboard --enable-webkit --enable-svg --with-expat --with-macosx-version-min=10.11 --enable-universal_binary=i386,x86_64 --disable-precomp-headers
$ sudo make install

$ cd wxPython
$ sudo python setup.py build_ext WXPORT=osx_cocoa WX_CONFIG=$PREFIX/bin/wx-config UNICODE=1 INSTALL_MULTIVERSION=1 BUILD_GLCANVAS=1 BUILD_GIZMOS=1 BUILD_STC=1

$ sudo python setup.py install WXPORT=osx_cocoa WX_CONFIG=$PREFIX/bin/wx-config UNICODE=1 INSTALL_MULTIVERSION=1 BUILD_GLCANVAS=1 BUILD_GIZMOS=1 BUILD_STC=1

To verify the installation:

$ python
>>> import wx
>>>

Note that this is a 64-bit setup, you don't have to run RIDE in 32-bit mode.