gpt4 book ai didi

python - 我如何在 virtualenv 中安装 wxPython

转载 作者:太空狗 更新时间:2023-10-29 20:16:07 26 4
gpt4 key购买 nike

我在 Mac OSX Lion 机器上,我已经下载了 wxPython-src-2.9.3.1.tar.bz2。然后我执行了以下操作(注意:输出消息已被删除):

$ tar -xjf wxPython-src-2.9.3.1.tar.bz2
$ cd wxPython-src-2.9.3.1
$ mkdir bld
$ cd bld
$ source /path/to/myvirtualenv/bin/activate
(myvirtualenv)$ cross_compiling=yes
(myvirtualenv)$ export MACOSX_DEPLOYMENT_TARGET=10.6.7
(myvirtualenv)$ set arch_flags="-arch ppc64 "
(myvirtualenv)$ ../configure \
--with-mac --enable-monolithic --enable-threads --enable-unicode \
--enable-debug_flag --enable-debug \
--with-libpng --with-libjpeg --with-libtiff --enable-unicode \
--with-opengl --enable-graphics_ctx --with-odbc --enable-gui \
--with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6 \
CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --prefix=/path/to/myvirtualenv/
$ (myvirtualenv)make
$ (myvirtualenv)make install

在那之后,我确实收到了这个消息(所以我猜它成功了):

...
------------------------------------------------------

The installation of wxWidgets is finished. On certain
platforms (e.g. Linux) you'll now have to run ldconfig
if you installed a shared library and also modify the
LD_LIBRARY_PATH (or equivalent) environment variable.

wxWidgets comes with no guarantees and doesn't claim
to be suitable for any purpose.

Read the wxWindows Licence on licencing conditions.

------------------------------------------------------

然后让我回到我的外壳。但是,我似乎无法使用它

(myvirtualenv)$ python
>>> import wxversion
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named wxversion

有什么办法可以将它安装到我的 virtualenv 中吗?

最佳答案

对于其他人,这是对我有用的:

在 Mac OSX 上,我使用 Homebrew 安装了 wxpython:

brew install wxpython

切换到您的 virtualenv 站点包目录:

cd /venv/lib/python2.7/site-packages

然后链接wx.pth

ln -s /usr/local/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx.pth wx.pth

然后链接wx-3.0-osx_cocoa目录:

ln -s /usr/local/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-3.0-osx_cocoa wx-3.0-osx_cocoa

关于python - 我如何在 virtualenv 中安装 wxPython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10457647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com