1
setup.py
で定義されたコンソールスクリプトエントリポイントを呼び出そうとすると、ImportError: No module named 'test.nested'
が表示されます。setup.pyのentry_pointsのImportError
プロジェクト構造:
test ├── setup.py └── test ├── __init__.py └── nested ├── __init__.py └── testme.py
setup.py
:from setuptools import setup, find_packages setup(name='test', version='0.1', packages=find_packages(), entry_points = { 'console_scripts': [ 'testme=test.nested.testme:main' ] }, zip_safe=False)
testme.py
:def main(): print('It works!') if __name__ == '__main__': main()
しかし、私はこのエラーを取得する:
> pip install .
Processing my_folders/test
Installing collected packages: test
Running setup.py install for test ... done
Successfully installed test-0.1
> testme
Traceback (most recent call last):
File "venv35/bin/testme", line 11, in <module>
load_entry_point('test==0.1', 'console_scripts', 'testme')()
File "venv35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 560, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "venv35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2648, in load_entry_point
return ep.load()
File "venv35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2302, in load
return self.resolve()
File "venv35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2308, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named 'test.nested'
は、問題はここで何をすることができますか?
注:python
シェルでこのコードは動作します:
>>> import test.nested.testme
>>> test.nested.testme.main()
It works!