我一直在尝试将软件包上传到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.
我似乎无法弄清楚为什么要这样做。如果有人知道,请告诉我。谢谢:))
答案 0 :(得分:0)
python setup.py register
和python setup.py upload
是deprecated。 不要使用它们。
按照Python Packaging Guide中的说明进行操作:
python setup.py sdist bdist_wheel
pip install twine
twine check dist/*
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
twine upload dist/*
答案 1 :(得分:-3)
也许仔细检查一下.pypirc文件实际上和setup.py在同一个目录中,因为在你的问题中你已经把它称为'〜/ .pypirc'。 '〜/'表示该文件位于您的主目录中,我认为该目录不在您希望的位置。