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'
문제가 여기에 무엇을 할 수 있습니다 : 1,363,210
는 그러나, 나는이 오류가?
참고 : python
쉘이 코드는 작동합니다
>>> import test.nested.testme
>>> test.nested.testme.main()
It works!