我的setup.py文件中有一个代码:from setuptools import setup, find_packages setup(name='PBI_telegrambot',version='0.0.1',author='junscience',description='Embedding app for
我的 setup.py 文件中有一个代码:
from setuptools import setup, find_packages
setup(
name='PBI_telegrambot',
version='0.0.1',
author='junscience',
description='Embedding app for classification',
packages=find_packages(include =['telegram_bot.py', 'login.py', 'screenshot.py']),
scripts=['telegram_bot.py'],
entry_points={
'console_scripts':[
'PBI_telegrambot=telegram_bot:main'
]
}
)
我的项目树如下所示:
build
bdist.linux-x86_64
scripts-3.8
telegram_bot.py
dist
PBI_telegrambot-0.0.1-py3.8.egg
env.txt
login.py
PBI_telegrambot.egg-info
dependency_links.txt
entry_points.txt
PKG-INFO
requires.txt
SOURCES.txt
top_level.txt
pycache
login.cpython-311.pyc
screenshot.cpython-311.pyc
requirements.txt
screenshot.py
setup.py
telegram_bot.py
首先,我安装要求,通过: pip install -r requirements.txt
我尝试在 Ubuntu 中安装代码: sudo python3 setup.py install
并运行它: PBI_telegrambot
但收到错误:
/usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (2.2.2) or chardet (5.2.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "/usr/local/bin/PBI_telegrambot", line 11, in <module>
load_entry_point('PBI-telegrambot==0.0.1', 'console_scripts', 'PBI_telegrambot')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/bin/telegram_bot.py", line 4, in <module>
import('pkg_resources').run_script('PBI-telegrambot==0.0.1', 'telegram_bot.py')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/telegram_bot.py' not found in metadata at '/home/user/.local/lib/python3.8/site-packages/PBI_telegrambot-0.0.1.dist-info'
将非常感谢您的帮助!
我尝试使用 pip: 创建一个项目 pip install .
,但遇到了同样的问题