简体   繁体   English

上传失败 (403):无效或不存在的身份验证信息:Python

[英]Upload failed (403): Invalid or non-existent authentication information: Python

I am trying to distribute a sample package.我正在尝试分发示例包。 I am following the below mentioned steps:我正在遵循以下提到的步骤:

1) python.exe setup.py register 1) python.exe setup.py register

Here I decide to use the existing login and provide my username and pssaword.在这里,我决定使用现有的登录名并提供我的用户名和 pssaword。 I get this message:我收到这条消息:

在此处输入图片说明

2) python.exe setup.py sdist upload 2) python.exe setup.py sdist upload

But when I fire this I get the above mentioned error in the summary.但是当我触发它时,我在摘要中收到上述错误。 在此处输入图片说明

This is my directory structure这是我的目录结构在此处输入图片说明

I am following the steps as mentioned in Head First Python book.我正在遵循 Head First Python 书中提到的步骤。 Can some one please guide me?有人可以指导我吗? Am I missing some step?我错过了一些步骤吗?

I am also uploading my contents of my setup file.我也在上传我的安装文件的内容。 在此处输入图片说明

NOTE: I am a beginner in python and have just started learning it.注意:我是 Python 的初学者,刚刚开始学习它。

python setup.py register and python setup.py upload are deprecated . python setup.py registerpython setup.py upload弃用 Do not use them.不要使用它们。

Follow the instructions in the Python Packaging Guide :按照Python 打包指南中的说明进行操作:

  1. Create an account on PyPI if you haven't yet.如果您还没有,请在PyPI上创建一个帐户。
  2. Create the source distribution and wheels for your package: python setup.py sdist bdist_wheel为您的包创建源分发和轮子: python setup.py sdist bdist_wheel
  3. Install twine (or make sure you have version 2.0 or newer): pip install twine安装twine (或确保您有 2.0 或更高版本): pip install twine
  4. Check your distribution files for errors: twine check dist/*检查您的分发文件是否有错误: twine check dist/*
  5. (Optional) Upload to the PyPI test server first (note: separate user registration required): twine upload --repository-url https://test.pypi.org/legacy/ dist/* (可选)先上传到PyPI测试服务器(注意:需要单独注册用户): twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  6. Upload to PyPI: twine upload dist/*上传到 PyPI: twine upload dist/*

To save typing your PyPI credentials, create $HOME/.pypirc with the following contents:为了避免输入 PyPI 凭据, $HOME/.pypirc使用以下内容创建$HOME/.pypirc

[pypi]
username = <username>
password = <password>

Note: your password will be stored in plain text!注意:您的密码将以纯文本形式存储!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM