My package的setup.py中定义了入口点:
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='fbuildbot',
version='0.1',
...
entry_points={
'console_scripts': [
'create = create:main',
],
},
install_requires=[
"cookiecutter",
],
)
问题是,如果我执行python setup.py develop
,我可以很好地运行该命令,但是如果我使用python setup.py install
安装它,安装过程将正确运行,但是控制台脚本将使用ImportError
失败:
Traceback (most recent call last):
File "/home/matias/.venvs/fbuild/bin/create", line 8, in <module>
load_entry_point('fbuildbot==0.1', 'console_scripts', 'create')()
File "/home/matias/.venvs/fbuild/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point
File "/home/matias/.venvs/fbuild/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2221, in load_entry_point
File "/home/matias/.venvs/fbuild/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
ImportError: No module named create
很明显,它无法在pythonpath上正确设置包。我以为这是因为我的剧本几乎没有达到最高水平。所以我试着把它们包装在一个包里,把所有重要的部分移到一个内部模块中,并相应地改变setup.py
:
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='fbuildbot',
version='0.1',
description="Buildbot configuration generator for fbuild",
...
packages=['fbuildbot', ],
entry_points={
'console_scripts': [
'create = fbuildbot.create:main',
],
},
install_requires=[
"cookiecutter",
],
)
但它失败的消息是相同的(显然是更新了路径)。
很明显我在这里做错了。可能是什么?
问题出在您的packages参数中。您只需指定:
不是
所以您的设置实际上并没有安装“create”模块。找不到是有道理的。
我建议使用find_packages实用程序
它会帮你处理所有的事情。
相关问题 更多 >
编程相关推荐