16

I am trying to use twine to publish my first python package on pypi (of course will add on test-pypi first).

I followed the official guideline on https://packaging.python.org/tutorials/packaging-projects/.

But for some reason, twine is not found or not properly installed.

I installed twine using:

pip install twine

"pip list" says twine is installed on pip.

After I upgraded twine and everything, when I tried to run:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

then it says that twine is not found at all:

-bash: twine: command not found . 

My system is mac (high sierra) and I am using python2.7 by conda. Pip is also configured to conda python:

>>pip -V 
>>pip 10.0.1 from /anaconda2/lib/python2.7/site-packages/pip (python 2.7)

I would appreciate your help.

4

2 回答 2

24

利用python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

于 2018-12-26T02:51:15.957 回答
2

基于@hoefling 评论运行

pip show 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/twineLocation: /Users/hakuna.matata/.local/lib/python3.6/site-packages。当然,您的用户名将替换“hakuna.matata”

这将导致打包可执行文件的路径/Users/hakuna.matata/.local/bin,您可以将其添加到您的.bash_profileas export PATH="/Users/hakuna.matata/.local/bin:$PATH"

然后,重新启动终端或

source ~/.bash_profile
于 2019-01-04T18:14:12.690 回答