今天新封装了一个改变pycharm控制台颜色的pypi包:consolecolor
一路过坑,最后成功上传
https://pypi.python.org/pypi/consolecolor/0.0.1问题的发生与解决
第一次尝试
按照我之前的套路,一步一步来:
原文:
Python编程:为世界贡献你的轮子-pipy打包输入指令:
python setup.py sdist upload
不出所料,成功报错,
Upload failed (403): Invalid or non-existent authentication information.
上次上传是:2018年03月19日,才一个月不到,竟然这么多麻烦。
第二次尝试
我以为是账号密码不对,
百度后参考:
发布你自己的轮子 - PyPI打包上传实践说是
~/.pypirc
文件配置不对,开始各种修改,当然,还是不对
第三次尝试
继续百度:
python打包代码上传PYPI出现错误500,虚心求教这里我第一次看到
twine
包,好吧
根据提示提示跳转到了官网:
Uploading your Project to PyPI换种方式继续尝试
pip install twine
twine upload dist/*
twine上传pypi包报错如下:
输入报错:权限验证失败
HTTPError: 403 Client Error: Invalid or non-existent authentication information.
for url: https://upload.pypi.org/legacy/
第四次尝试
我删除
~/.pypirc
文件后,采用输入账号密码的方式,继续试
HTTPError: 400 Client Error: User 'mouday' has no verified email addresses,
please verify at least one address before registering a new project on PyPI.
See https://upload.pypi.org/help/#verified-email for more information.
for url: https://upload.pypi.org/legacy/
里边提到需要
验证邮箱地址
,按照报错提示打开连接,完全没有验证邮箱的提示,打开
pypi后台也没有找到验证邮箱的地方,一脸懵逼。。。
第五次尝试
最后找到stackoverflow:
verified-email-addresses-while-pushAlright, I figured out:
You need to login to https://pypi.org/
instead of the old https://pypi.python.org/pypi.
https://pypi.org shows a "pre-production" warning on top, but that doesn't matter.
Login to your account, go to account setting, and verify your email.
The old site doesn't have a way to check whether your email is verified or not.
大概意思就是你要访问:
重点
https://pypi.org/ 验证你的邮箱,打开连接之后,正常登陆 pypi 账号,找到下面 options 发送一份确认邮件,点击收到的邮件的确认连接,确认一下就行。
最后提交成功
总结
此次的关键点在于
验证 pypi 邮箱
验证完就很简单了:
# 第一步,安装twine
pip install twine
# 第二步,创建setup.py文件,见参考文章[1]
# 第三步,打包
python setup.py sdist
# 第四步,上传,根据提示数据用户名和密码,也可以配置 $HOME/.pypirc 文件
twine upload dist/*
参考: