如何使用 virtualenv 安装 wxPython

发布于 2024-11-30 10:47:30 字数 1010 浏览 1 评论 0 原文

我正在尝试开始一个新的 python GUI 应用程序,并且我决定使用 wxPython 作为 GUI,因为我想要一个多平台应用程序。

问题是我想使用 virtualenv (与 virtualenvwrapper )来隔离环境并能够在我将工作的其他机器上重现它,但我无法安装 wxPython。

我通过 apt-get 将其安装在我的 ubuntu 机器上,但这还不够,

我在网上搜索了解决方案,并且发现了...

  • 此页面 http://batok.github.com/virtualenvwxp/ 其中解释了一种破解 virtualenv 环境以使用本地安装的 wxPython 的方法。这不是最好的解决方案,但这将是一个很好的解决方法。问题是它是针对 Mac 进行解释的,但我无法使其在我的 ubuntu 中工作。

  • 还发现此页面Installing wxPython in virtualenv under Linux有人问类似的东西。我尝试以这种方式构建wxPython,但没有成功。

任何帮助将不胜感激。

最后,我选择了 wxPython,因为它是多平台的,我可以在没有许可证问题的情况下使用它,但由于我还没有开始,如果有另一个更容易安装的框架,我可以改变主意。

提前致谢

20110925:抱歉耽搁了时间,感谢您的回答。 我刚刚尝试使用 buildout 和此处给出的链接安装 wxpython,但我仍然遇到同样的问题。似乎我需要 libgtk2.0-dev 包才能编译 wxpython...

那么有什么方法可以将此包本地安装到构建环境中?

再次感谢。

I am trying to begin a new python GUI application and I have decided to use wxPython as GUI because I want a multi-platform one.

The problem is that I want to use virtualenv ( with virtualenvwrapper ) to isolate the environment and be able to reproduce it in other machines where I will work, but i cannot install wxPython.

I have it installed in my ubuntu machine via apt-get but that is not enough

I have searched the web for a solution and i have found ...

  • This page http://batok.github.com/virtualenvwxp/ where it is explained a way to hack the virtualenv environment to use the local installation of wxPython. Not the best solution, but it would be a good workaround. The problem is that it is explained for Mac, and I couldnt make it work in my ubuntu.

  • Also found this page Installing wxPython in virtualenv under Linux where someone ask something similar. I have tried to build wxPython that way with no success.

Any help would be appreciated.

In the end, I have choose wxPython beacuse it is multiplatform and i can use it without license problems, but as i have not started yet i can change my mind if there is another easier to install framework.

Thanks In advance

20110925: Sorry for the delay and thanks for the answers.
I just have tried to install wxpython using buildout and the links given here, but i still have the same problem. It seems as if I need libgtk2.0-dev package to be able to compile wxpython...

So there is any way to install this package locally to the buildout environment?

Thanks again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怼怹恏 2024-12-07 10:47:30

最后我没能解决这个问题。

我想使用 buildout 和/或 virtualenv 创建一个可重现的 python 环境,其中包含所有要求,这样我就可以在任何安装了 virtualenv、python 和 C++ 编译器的 Linux 系统中工作。

似乎唯一的方法是使用 buildout cmmi 配方来下载和构建 wxpython 及其所有依赖项。这是一个非常痛苦的方式,而且我现在没有时间。

我决定使用一个解决方法:我大部分时间都会在我的 ubuntu 笔记本电脑上工作,因此我从存储库安装了 wxpython 并使用 wx.pth 文件使其可用于虚拟环境。

这不是一个好的解决方案,但迄今为止似乎是最好的解决方案......所以如果有人知道更好的解决方案,请告诉我。

当我的Python项目更加成熟时,我将再次转向这个问题,我可能会尝试困难的方法......

感谢您的所有回答和评论。

At the end I could not resolve this problem.

I want to create a reproducible python environment with all the requirements inside using buildout and/or virtualenv so I could work in any linux system with just virtualenv, python and a C++ compiler installed.

It seems that the only way to do this is to use buildout cmmi recipes to download and build wxpython and ALL its dependencies. This is a really painful way, and I have no time now.

I have decided to use a workaround: I am going to work on my ubuntu laptop most of the time, so I have installed wxpython from the repositories and use a wx.pth file to make it available to the virtual environment.

This is not a good solution, but seems the best till now ... so if someone knows any better solution please let me know.

When my python project is more mature, I will turn again to this problem and I will probably try the hard way ...

Thanks for all your answers and comments.

无畏 2024-12-07 10:47:30

我最终使用的解决方案是将 python 安装到我的主系统:

然后从我的系统 python 中的 wx 到我的虚拟环境建立一个符号链接:

ln -s /usr/lib/python2.7/dist-packages/wxversion.py <virtual_env_path>/lib/python2.7/site-packages/wxversion.py

在我的情况下,名为“fibresim”的虚拟环境的路径是:

/home/adam/anaconda/envs/fibersim

然后 import wx 工作了

从以下位置获取:http://qopml.org/wp-content/uploads/2013/01/README.txt

The solution I ended up using was to install python to my main system:

Then make a symbolic link from the wx in my system python to my virtual environment:

ln -s /usr/lib/python2.7/dist-packages/wxversion.py <virtual_env_path>/lib/python2.7/site-packages/wxversion.py

Where is the path in my case to a virtual environment named "fibersim" for example is:

/home/adam/anaconda/envs/fibersim

Then import wx worked

Got this from: http://qopml.org/wp-content/uploads/2013/01/README.txt

喵星人汪星人 2024-12-07 10:47:30

Buildout 允许您安装不同的部件recipe代码决定了该部件的构建方式。有 cmmi 配方用于使用配置/制作/制作安装( CMMI)。您可以使用它在构建本地构建 wxPython,然后创建一个 python解释器,它具有 wxPython 的构建以及您自己的鸡蛋在它的路径中。

请参阅此博客文章这个答案 细节。

请记住,zc.recipe.egg 还将安装任何 setuptools/distribute console_scripts 也在构建的 bin 目录中。另请参阅 mr.developer自动从 VCS 中签出多个包,并在同一个构建中处理它们。

Buildout allows your to install different parts whose recipe code determines how that part is built. There are cmmi recipes for building stuff with Configure/Make/Make-Install (CMMI). You can use this to build wxPython locally to the buildout and then create a python interpreter that has that build of wxPython and your own eggs in it's path.

See this blog post and this answer for details.

Keep in mind that zc.recipe.egg will also install any setuptools/distribute console_scripts in the buildout's bin directory as well. See also mr.developer for automatically checking out multiple packages from VCS and working on them in the same buildout.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文