我正在尝试使用twine在pypi上发布我的第一个python包(当然会先在test-pypi上添加)。
我遵循了https://packaging.python.org/tutorials/packaging-projects/上的官方指南。
但是由于某些原因,找不到或未正确安装麻线。
我使用以下方法安装了麻线:
pip install twine
“点子列表”显示麻线已安装在点子上。
我升级了麻线和所有东西后,尝试运行时:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
然后它说根本找不到麻线:
-bash: twine: command not found .
我的系统是mac(高山脉),我使用的是conda的python2.7。 Pip还配置为conda python:
>>pip -V
>>pip 10.0.1 from /anaconda2/lib/python2.7/site-packages/pip (python 2.7)
感谢您的帮助。
答案 0 :(得分:4)
使用python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
答案 1 :(得分:0)
基于@hoefling注释运行
pip show -f twine
这将列出属于twine
软件包的所有文件。它将输出如下内容:
Name: twine Version: 1.12.1 Summary: Collection of utilities for publishing packages on PyPI Home-page: https://twine.readthedocs.io/ Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: Apache License, Version 2.0 Location: /Users/hakuna.matata/.local/lib/python3.6/site-packages Requires: pkginfo, readme-renderer, tqdm, requests, requests-toolbelt, setuptools Required-by: Files: ../../../bin/twine twine-1.12.1.dist-info/INSTALLER twine-1.12.1.dist-info/LICENSE.txt twine-1.12.1.dist-info/METADATA twine-1.12.1.dist-info/RECORD twine-1.12.1.dist-info/WHEEL twine-1.12.1.dist-info/entry_points.txt twine-1.12.1.dist-info/top_level.txt twine/__init__.py twine/__main__.py twine/__pycache__/__init__.cpython-36.pyc twine/__pycache__/__main__.cpython-36.pyc twine/__pycache__/_installed.cpython-36.pyc twine/__pycache__/cli.cpython-36.pyc twine/__pycache__/exceptions.cpython-36.pyc twine/__pycache__/package.cpython-36.pyc twine/__pycache__/repository.cpython-36.pyc twine/__pycache__/settings.cpython-36.pyc twine/__pycache__/utils.cpython-36.pyc twine/__pycache__/wheel.cpython-36.pyc twine/__pycache__/wininst.cpython-36.pyc twine/_installed.py twine/cli.py twine/commands/__init__.py twine/commands/__pycache__/__init__.cpython-36.pyc twine/commands/__pycache__/check.cpython-36.pyc twine/commands/__pycache__/register.cpython-36.pyc twine/commands/__pycache__/upload.cpython-36.pyc twine/commands/check.py twine/commands/register.py twine/commands/upload.py twine/exceptions.py twine/package.py twine/repository.py twine/settings.py twine/utils.py twine/wheel.py twine/wininst.py
请注意Files
下的第一个文件是../../../bin/twine
和Location: /Users/hakuna.matata/.local/lib/python3.6/site-packages
。当然,您的用户名将替换“ hakuna.matata”
这将导致在/Users/hakuna.matata/.local/bin
处打包可执行文件的路径,您可以将其以.bash_profile
的形式添加到export PATH='/Users/hakuna.matata/.local/bin:$PATH'
中
然后,重新启动终端或
source ~/.bash_profile