我可以轻松复制您的问题,实际上即使不使用您的包:
$python empty
.env/bin/python: can't open file 'empty': [Errno 2] No such file or directory
$mkdir empty
$python empty
.env/bin/python: can't find '__main__' module in 'empty'
$python Empty
.env/bin/python: can't find '__main__' module in 'Empty'
所以你根本没有调用你的库,你只是给Python解释器一个不存在的脚本名称,如果在工作目录中有一个类似命名的目录(不区分大小写),它会尝试执行它.
我能够很好地从PyPi安装你的软件包并且可以正常导入它,但似乎没有任何入口点,在顶级导出没有任何有用的东西,并且没有可执行脚本添加到Python bin:
>>> import etltest
>>> dir(etltest)
['__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__',
'__path__', '__version__']
直接按照Quickstart from your docs中的建议运行etlTest.py也不起作用:
$python .env/lib/python2.7/site-packages/etltest/etlTest.py
2014-07-13 17:19:56,831 - settings - DEBUG - Attempting to load .env/lib/python2.7/site-packages/.etltest-settings.yml
2014-07-13 17:19:56,832 - settings - WARNING - No such file or directory .env/lib/python2.7/site-packages/.etltest-settings.yml
2014-07-13 17:19:56,832 - settings - DEBUG - Attempting to load .env/lib/python2.7/site-packages/.etltest-settings.yml
2014-07-13 17:19:56,832 - settings - WARNING - No such file or directory .env/lib/python2.7/site-packages/.etltest-settings.yml
2014-07-13 17:19:56,832 - settings - WARNING - Could not find settings file in .env/lib/python2.7/site-packages/.etltest-settings.yml,.env/lib/python2.7/site-packages/.etltest-settings.yml. Using defaults where present.
Traceback (most recent call last):
File ".env/lib/python2.7/site-packages/etltest/etlTest.py", line 73, in
main(sys.argv[1:])
File ".env/lib/python2.7/site-packages/etltest/etlTest.py", line 22, in main
SettingsManager().first_run_test()
File ".env/lib/python2.7/site-packages/etltest/utilities/settings_manager.py", line 29, in __init__
self.app_name = etltest_config['app_name']
KeyError: 'app_name'
我说你的包装不适合分配.您可能希望清理开发环境中的某些依赖项,并阅读setuptools entry points以提供正确的命令行可执行文件以及您的程序包.如果它不是某种测试版本,它也不应该默认在调试模式下运行.