我一直在尝试将Python包上传到Pypi。我一直在遵循几个不同的指南。我已使用安装捆绳
pip install twine
它没有显示出任何问题:
Requirement already satisfied: twine in
c:usersamirhappdataroamingpythonpython36site-packages (1.11.0)
Requirement already satisfied: setuptools>=0.7.0 in
c:usersamirhappdataroamingpythonpython36site-packages (from twine)
(40.0.0)
Requirement already satisfied: tqdm>=4.14 in
c:usersamirhappdataroamingpythonpython36site-packages (from twine)
(4.23.4)
Requirement already satisfied: pkginfo>=1.4.2 in c
:usersamirhappdataroamingpythonpython36site-packages (from twine) (
1.4.2)
Requirement already satisfied: requests!=2.15,!=2.16,>=2.5.0 in
c:usersamirhappdataroamingpythonpython36site-packages (from twine)
(2.19.1)
Requirement already satisfied: requests-toolbelt>=0.8.0 in
c:usersamirhappdataroamingpythonpython36site-packages (from twine)
(0.8.0)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in
c:usersamirhappdataroamingpythonpython36site-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:usersamirhappdataroamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in
c:usersamirhappdataroamingpythonpython36site-packages (from
requests!=2.15,!=2.16,>=2.5.0->twine) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in
c:usersamirhappdataroamingpythonpython36site-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
我得到了"葡萄酒"不被认为是内部或外部命令,可操作程序或批处理文件。cmd中的"注释。
我正在使用Windows 10。我应该自己为麻线创建某种环境变量吗?
我遇到了同样的问题。我在windows 10上使用了Anaconda,也就是说,使用Anaconda Prompt。经过一番搜索后,发现麻线.exe位于以下文件夹中:
C:UsersmynameAppDataRoamingPythonPython36Scripts
根据您提供的输出,我猜麻线.exe位于您的文件夹中:
c:usersamirhappdataroamingpythonpython36Scripts
因此,您可以将此文件夹路径添加到环境变量path中:系统属性->环境变量->系统变量->PATH(编辑(
然后,重新打开您的Anaconda提示符(或命令提示符(并键入
twine upload -r pypitest dist/packagename-0.1.2.tar.gz
我也遇到了同样的问题,但通过更新环境变量PATH并没有解决这个问题。
我使用的是Windows 10、Anaconda3和Python 3.9。这个教程在包装和更新包方面帮了我很多忙:
这是命令,而不是twine upload -r pypitest dist/packagename-0.1.2.tar.gz
。
首先升级twine
py -m pip install --user --upgrade twine
然后,运行twine
,使用以下命令上传dist
下的所有档案:
py -m twine upload --repository testpypi dist/*
请参阅我上面提到的教程中的更多内容。
你可以试试这个:
python -m twine upload -r pypitest dist/packagename-0.1.2.tar.gz
除了名为"path"的变量外,您还必须将python脚本路径作为环境变量包含在用户变量中。当麻线安装在脚本中时,这将使事情非常适合您,因此必须将其传递给环境变量,才能从任何目录访问麻线。