My first attempt at using python setuptools. I am using wxPython in the project. I am using the following import lines
import wx, random
from wx.lib import buttons
And in my setup.py I have
setup(
name='name',
version='0.2p',
description='...',
author='...',
author_email='...',
packages=['name'],
long_description=open(
path.join(
path.dirname(__file__),
'README'
)
).read(),
install_requires=[
'setuptools',
'MySQL-python',
'wx',
'ObjectListView'
],)
When I use easy_install on the .egg everything seems fine. But when I run the main method from where the project has been installed, I get the failed import message:
from wx.lib import buttons
ImportError: No module named lib
Do I need to explicity require the wx.lib module in the setup.py file?
The problem has nothing to do with your
setup.pyfile, rather you’re missing a step in your import statements. You need to explicitly import thelibmodule fromwx. It should look something like this:Edit: Actually, there is a problem with the
setup.pyinstall_requires. You want to requirewxPythonand NOTwx.wxis an entirely different package in Python’s package index.You do still need that extra
import wx.libin your import statements however.