安装我的python项目setup.py
并在终端中执行它后,我得到以下错误:
... from ui.mainwindow import MainWindow File "/usr/local/lib/python2.7/dist-packages/EpiPy-0.1-py2.7.egg/epipy/ui/mainwindow.py", line 9, infrom model.sir import SIR ImportError: No module named model.sir
...
我们假设我们的项目有以下结构cookies
:
. ??? setup.py ??? src ??? a ? ??? aa.py ? ??? __init__.py ??? b ? ??? bb.py ? ??? __init__.py ??? __init__.py ??? main.py
文件: cookies/src/main.py
from a import aa def main(): print aa.get_aa()
文件 cookies/src/a/aa.py
from b import bb def get_aa(): return bb.get_bb()
文件: cookies/src/b/bb.py
def get_bb(): return 'bb'
文件: cookies/setup.py
#!/usr/bin/env python import os import sys try: from setuptools import setup, find_packages except ImportError: raise ImportError("Install setup tools") setup( name = "cookies", version = "0.1", author = "sam", description = ("test"), license = "MIT", keywords = "test", url = "asd@ads.asd", packages=find_packages(), classifiers=[ """\ Development Status :: 3 - Alpha Operating System :: Unix """ ], entry_points = {'console_scripts': ['cookies = src.main:main',],}, )
如果我安装cookies
作为root
与$ python setup.py install
和执行cookies
我收到以下错误:ImportError: No module named b
.我该如何解决这个问题.