我尝试将软件包上传到pypi,但是在其他地方安装时无法运行。
Traceback (most recent call last):
File "/Users/bestony/Downloads/abc-mod/venv/bin/abc", line 7, in <module>
from xxx.core import main
ModuleNotFoundError: No module named 'abc'
我尝试使用pip install abc
和pip install -e path_to_my_code
,并在venv / bin / abc中读取代码。
这是代码
# this code can run due to use local code
#!/Users/bestony/Downloads/abc-mod2/venv/bin/python3.6
# EASY-INSTALL-ENTRY-SCRIPT: 'abc','console_scripts','abc'
__requires__ = 'abc'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('abc', 'console_scripts', 'abc')()
)
和
# this code can't run
#!/Users/bestony/Downloads/abc-mod/venv/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from abc.core import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
这是我的setup.py
代码
from setuptools import setup
setup(
name="abc",
version="0.0.5",
py_modules=['abc'],
install_requires= [
'click',
'requests',
],
entry_points="""
[console_scripts]
abc=abc.core:main
"""
)
这里有人知道为什么吗?