开发者

How to install wxPython using virtualenv

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.


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜