使用Windows 10将Python包上传到Pypi的问题 - twine不被认为是内部或外部的推荐
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Windows 10将Python包上传到Pypi的问题 - twine不被认为是内部或外部的推荐相关的知识,希望对你有一定的参考价值。
我一直在尝试将Python包上传到Pypi。我一直在关注几个不同的指南。我已经安装了麻线
pip install twine
它没有显示任何问题:
Requirement already satisfied: twine in
c:usersamirhappdata
oamingpythonpython36site-packages (1.11.0)
Requirement already satisfied: setuptools>=0.7.0 in
c:usersamirhappdata
oamingpythonpython36site-packages (from twine)
(40.0.0)
Requirement already satisfied: tqdm>=4.14 in
c:usersamirhappdata
oamingpythonpython36site-packages (from twine)
(4.23.4)
Requirement already satisfied: pkginfo>=1.4.2 in c
:usersamirhappdata
oamingpythonpython36site-packages (from twine) (
1.4.2)
Requirement already satisfied: requests!=2.15,!=2.16,>=2.5.0 in
c:usersamirhappdata
oamingpythonpython36site-packages (from twine)
(2.19.1)
Requirement already satisfied: requests-toolbelt>=0.8.0 in
c:usersamirhappdata
oamingpythonpython36site-packages (from twine)
(0.8.0)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in
c:usersamirhappdata
oamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in
c:usersamirhappdata
oamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in
c:usersamirhappdata
oamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in
c:usersamirhappdata
oamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (2018.4.16)
当使用任何类型的麻线功能时
twine upload -r pypitest dist/packagename-0.1.2.tar.gz
我得到“'twine'不被识别为内部或外部命令,可操作程序或批处理文件。”“来自cmd的评论。
我正在使用Windows 10.我应该为twine自己创建一些环境变量吗?
答案
我遇到了同样的问题。我在Windows 10上使用Anaconda,即使用Anaconda Prompt。经过一番搜索,发现twine.exe位于文件夹中:
C:UsersmynameAppDataRoamingPythonPython36Scripts
从您提供的输出,我猜twine.exe位于您的文件夹中:
c:usersamirhappdata
oamingpythonpython36Scripts
因此,您可以将此文件夹路径添加到您的环境变量PATH:系统属性 - >环境变量 - >系统变量 - > PATH(编辑)
然后,重新打开您的Anaconda提示符(或命令提示符)并键入
twine upload -r pypitest dist/packagename-0.1.2.tar.gz
另一答案
除了名为“Path”的变量之外,您还必须在您的用户变量中包含python脚本路径作为环境变量。这将使得事情完美适合您,因为twine安装在脚本中,因此必须将其传递给环境变量,以便从任何目录访问twine。
以上是关于使用Windows 10将Python包上传到Pypi的问题 - twine不被认为是内部或外部的推荐的主要内容,如果未能解决你的问题,请参考以下文章