【发布时间】:2022-11-20 04:40:08
【问题描述】:
我正在学习如何打包 python 项目并发布它们,我遇到了一个我一直试图解决的问题,但失败了。
我有这个小项目,我正在尝试将它上传到 Testpypi
我设法把它上传到那里,我什至可以在 (https://test.pypi.org/project/cli-assistant/) 找到它
问题:当我尝试使用安装它时
pip install -i https://test.pypi.org/simple/ cli-assistant
我收到此错误:
Looking in indexes: https://test.pypi.org/simple/
ERROR: Could not find a version that satisfies the requirement cli-assistant (from versions: none)
ERROR: No matching distribution found for cli-assistant
这是完整的 setup.py 文件
from setuptools import setup, find_packages
with open("Description.rst", "r", encoding="utf-8") as fh:
long_description = fh.read()
with open("requirements.txt", "r", encoding="utf-8") as fh:
requirements = fh.read()
setup(
name= 'cli-assistant',
version= '0.0.5',
author= 'my name',
author_email= 'my email',
license= 'MIT License',
description='guide you with terminal and git commands',
long_description=long_description,
url='https://github.com/willsketch/Helper',
py_modules=[ 'my_helper'],
packages= find_packages(),
install_requires = [requirements],
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
],
include_package_data=True,
package_data={'helper':['examples.txt']},
entry_points= {
'console_scripts':[
'helper = my_helper:cli',
]
}
)
【问题讨论】:
-
你只有 uploaded egg 文件。 pip 无法安装 eggs。您应该上传源代码分发版(.tar.gz 或 .zip)和/或轮子 (.whl)。
-
嘿伙计,非常感谢!它有效我怎么能接受你的答案作为最佳答案
标签: python pypi setup.py python-packaging