python - Twine 无法识别 --repository-url 标志

标签 python setuptools twine

我想使用 twine 将项目构建上传到 test.pypi.org。我正在遵循 twine GitHub page 中基本用例的自述文件。 。我已经安装了最新版本的 twine:

$ twine --version
twine version 1.5.0 (pkginfo: 1.2.1, requests: 2.9.1, setuptools: 20.7.0)`

但是当我尝试上传构建的项目时,出现以下错误:

$ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
usage: twine upload [-h] [-r REPOSITORY] [-s] [--sign-with SIGN_WITH]
                [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT]
                dist [dist ...]
twine upload: error: unrecognized arguments: --repository-url

这正是 Python Packaging Tutorial 上引用的代码行Twine README 和 --repository-url 应该是一个有效的标志。这是传递给标志而不是标志本身的参数的错误吗?如果是这样,我需要修复什么?

我的项目的 setup.py 文件:

import setuptools

with open('README.md', 'r') as fh:
    long_description = fh.read()

setuptools.setup(
    name='MyPackageName',
    version='0.1.0',
    author='J. Chamness',
    author_email='<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9d4c0fcd4d8d0d5f9ded4d8d0d597dad6d4" rel="noreferrer noopener nofollow">[email protected]</a>',
    description='MyDescription',
    long_description=long_description,
    long_description_content_type='text/markdown',
    url='https://test.pypi.org/legacy/',
    packages=setuptools.find_packages(),
    classifiers=(
        'Programming Language :: Python :: 3',
        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
        'Operating System :: OS Independent',
    ),
)

最佳答案

您正在使用旧版本的 twine (1.5.0)。如@phd observes , --repository-url 在版本 1.8 中添加到 twine 中。升级到最新版本以获得此功能:

pip install --upgrade twine

关于python - Twine 无法识别 --repository-url 标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51126774/

相关文章:

python - 以完整的方式重组数据框

python - Algolia 索引的 ObjectID 列表

python - "SELECT ... WHERE ... IN"参数数量未知

cython - 如何在 Cython 中正确包含头文件(setup.py)?

python - 由非 root 用户安装 python 包/工具

python-3.x - 在自定义包中安装 pip 时,如何修复 install_requires 列表的 'Could not find a version that satisfies the requirement'?

python - 在 Python 中加载与 Jinja2 嵌套的 YAML

python - setup.py、setuptools、cmdclass - 自定义命令不起作用

python-3.x - 使用代理服务器时 twine 上传失败

python - Twine 在不提示输入密码的情况下挂起