All the commands end without errors, and I am able to create and
install the packages for wxWidgets and wxPython as detailed in the
recipe. However, when I try to import wx in a Python shell, It returns
this error:
import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/wx/__init__.py", line
45, in <module>
from wx._core import *
File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 4,
in <module>
import _core_
ImportError: No module named _core_
I also searched for the module within the system and it's not present,
there is no _core_.py file.
Any idea of what went wrong with the installation? Am I missing any
requirement before installing?
it does not fail (no ImportError). Now, is it possible to set a system default wx version so it does not throw an ImportError when there’s no wx versions selected?
Of course the default wxPython version can also be controlled by
setting PYTHONPATH or by editing the wx.pth path configuration file,
but using wxversion will allow an application to manage the version
selection itself rather than depend on the user to setup the
environment correctly.
Am Montag, 29. April 2013 13:42:23 UTC+2 schrieb Alan Etkin:
it does not fail (no ImportError). Now, is it possible to set a system default wx version so it does not throw an ImportError when there’s no wx versions selected?
it does not fail (no ImportError). Now, is it possible to set a system
default wx version so it does not throw an ImportError when there's no
wx versions selected?
It sounds like the wx.pth file is not being included in your .deb package. It is a generated file that should be installed to your site-packages folder which contains the folder name for the version of wxPython that should be the default. (IOW, that folder is put on the sys.path automatically.) In your case it would contain something like "wx-2.9.4-gtk2"
For my os with two versions of wx, the one provided by Ubuntu and the
other.
It sounds like the wx.pth file is not being included in your .deb
package. It is a generated file that should be installed to your
site-packages folder which contains the folder name for the version of
wxPython that should be the default. (IOW, that folder is put on the
sys.path automatically.)
In your case it would contain something like
"wx-2.9.4-gtk2"
Right (although I have no idea how to check the .deb problem), wx.pth
is set to 2.9
This is the default sys.path output (no PYTHONPATH set) when I run a
Python shell in the console:
As Torsten noted, setting the PYTHONPATH to whichever package path
present in the system before running the Python shell solves the
problem, or better, using wxversion.select when possible.
The only issue occurs when you try the code posted initially, where
wx.pth is set to 2.9 but there seems to be some routes conflict while
using the import command.
Maybe you forget to do execute ldconfig (it refreshes the shared library cache)
This should be added as a post-installation step to the .deb, but I
didin't figured out how.
For my os with two versions of wx, the one provided by Ubuntu and the
other.
It sounds like the wx.pth file is not being included in your .deb
package. It is a generated file that should be installed to your
site-packages folder which contains the folder name for the version of
wxPython that should be the default. (IOW, that folder is put on the
sys.path automatically.)
In your case it would contain something like
"wx-2.9.4-gtk2"
Right (although I have no idea how to check the .deb problem), wx.pth
is set to 2.9
The deb generated with checkinstall just does the same as make
install: it puts the wx.pth in /usr/local/lib/python2.7/dist-packages
As that directory is before /usr/lib/python2.7/dist-packages/ in the
PYTHONPATH, I think it takes precedence.
BTW, deb are just a compressed package, you can open it with any archiver.
I think that if 2.9 is installed, it SHOULD NOT take precedence over
2.8, because it will break existing apps (wxGlade, for example)
If anyone know how to solve this issues or how to make a .deb without
this issues, that would be great