无法将包上传到PyPi

时间:2018-02-16 00:56:28

标签: python python-3.x pypi

我一直在尝试将软件包上传到PyPi。我每次都会收到此错误。

Upload failed (403): Invalid or non-existent authentication information. 
error: Upload failed (403): Invalid or non-existent authentication information. 

我首先搜索了一下,发现在GitHub上有几个问题。我按照每个人说的工作,没有骰子。

我在我的setup.py文件所在的目录中创建了一个〜/ .pypirc文件,其内容如下所示:

[distutils]
index-servers =
pypi

[pypi]
username: shadeyg56
password: 

我填写了密码部分,但显然我不打算分享 然后我跑了     python setup.py sdist上传 在正确的目录中,它返回了

running sdist
running egg_info
writing shades_package.egg-info\PKG-INFO
writing dependency_links to shades_package.egg-info\dependency_links.txt
writing top-level names to shades_package.egg-info\top_level.txt
reading manifest file 'shades_package.egg-info\SOURCES.txt'
writing manifest file 'shades_package.egg-info\SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst,
README.txt

running check
creating shades_package-0.1
creating shades_package-0.1\shades_package
creating shades_package-0.1\shades_package.egg-info
copying files to shades_package-0.1...
copying setup.py -> shades_package-0.1
copying shades_package\__init__.py -> shades_package-0.1\shades_package
copying shades_package\test.py -> shades_package-0.1\shades_package
copying shades_package.egg-info\PKG-INFO -> shades_package-0.1\shades_package.eg
g-info
copying shades_package.egg-info\SOURCES.txt -> shades_package-0.1\shades_package
.egg-info
copying shades_package.egg-info\dependency_links.txt -> shades_package-0.1\shade
s_package.egg-info
copying shades_package.egg-info\not-zip-safe -> shades_package-0.1\shades_packag
e.egg-info
copying shades_package.egg-info\top_level.txt -> shades_package-0.1\shades_packa
ge.egg-info
Writing shades_package-0.1\setup.cfg
Creating tar archive
removing 'shades_package-0.1' (and everything under it)
running upload
Password:
Submitting dist\shades_package-0.1.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.

我似乎无法弄清楚为什么要这样做。如果有人知道,请告诉我。谢谢:))

2 个答案:

答案 0 :(得分:0)

python setup.py registerpython setup.py uploaddeprecated不要使用它们。

按照Python Packaging Guide中的说明进行操作:

  1. 如果尚未在PyPI上创建一个帐户。
  2. 为您的包裹创建源分布和轮子:python setup.py sdist bdist_wheel
  3. 安装twine(或确保您具有2.0版或更高版本):pip install twine
  4. 检查分发文件中的错误:twine check dist/*
  5. (可选)首先Upload to the PyPI test server(注意:需要单独的用户注册):twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  6. 上传到PyPI:twine upload dist/*

答案 1 :(得分:-3)

也许仔细检查一下.pypirc文件实际上和setup.py在同一个目录中,因为在你的问题中你已经把它称为'〜/ .pypirc'。 '〜/'表示该文件位于您的主目录中,我认为该目录不在您希望的位置。

相关问题