0

我尝试将一个包上传到 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 abcandpip 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
    """
)

这里有人知道为什么吗?

4

0 回答 0