Python | 发包 2018 入坑记录
最近业务需要抽离,抽离出来的应用需要做成 Django 第三方包的形式,可以在任何 Django(也没那么神奇,例如有些版本就没测试)版本项目中,直接安装使用,所以这里还是需要发包到 pypi。
第一次发包
我是先发到 test 环境 https://testpypi.python.org/
,看下发包还是不是符合我的预期,毕竟很长时间没发过包。
twine upload -r pypitest dist/django-xxxxx-0.0.1.tar.gz
Uploading distributions to https://test.pypi.org/legacy/
Uploading django-xxxxx-0.0.1.tar.gz
0%| | 0.00/18.5k [00:00<?, ?B/s]
SSLError: HTTPSConnectionPool(host='test.pypi.org', port=443): Max retries exceeded with url: /legacy/ (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)'),))
结果打脸,查了下资料,http://pyfound.blogspot.hk/20...,摘出来一部分
There are two deadlines to upgrade your Python to a version with the latest TLS. The first comes soon, on April 30, 2017, when python.org sites without Extended Validation Certificates will stop supporting TLS 1.0 and 1.1. These sites include:testpypi.python.org
test.pypi.org
files.pythonhosted.org
大意是什么呢,意思就是提醒赶紧升级 python,那个后面只会只支持使用 TLS 1.2 版本的协议,低版本的不再支持了,很不幸,testpypi.python.org 这个测试站点停止支持 TLS 1.0 和 1.1
接着按照给出的例子,自己测了下
python -m pip install --upgrade requests
python -c "import requests; print(requests.get('https://www.howsmyssl.com/a/check', verify=False).json()['tls_version'])"
TLS 1.0
If you see "TLS 1.2", your interpreter's TLS is up to date. If you see "TLS 1.0" or an error like "tlsv1 alert protocol version", then you must upgrade. ↩
第二次发包
按照文档上讲的,我的 python 过时了,那就直接升到 2.7.14;升完再跑一遍
python -c "import requests; print(requests.get('https://www.howsmyssl.com/a/check', verify=False).json()['tls_version'])"
/Users/allen/Develop/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
TLS 1.2
这下是否可以省心了,继续我的发包
twine upload -r pypitest dist/django-xxxxx-0.0.1.tar.gz
Uploading distributions to https://test.pypi.org/legacy/
Uploading django-xxxxx-0.0.1.tar.gz
0%| | 0.00/18.5k [00:00<?, ?B/s]
SSLError: HTTPSConnectionPool(host='test.pypi.org', port=443): Max retries exceeded with url: /legacy/ (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)'),))
很不幸,继续躺着,谷歌了下 pip install pyOpenSSL
如果已经安装了,更新下,保险;
第三次发包
twine upload -r pypitest dist/django-xxxxx-0.0.1.tar.gz
Uploading distributions to https://test.pypi.org/legacy/
Uploading django-xxxxx-0.0.1.tar.gz
100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 18.5k/18.5k [00:08<00:00, 2.13kB/s]
终于跑起来了,小结下
- 如果 Python 版本低,升级
- 如果 pyOpenSSL 版本低,升级
- 如果 requests 版本低,升级
黑月亮
点滴记录,步步成长
推荐阅读
centos | 修改静态 IP
设置 Centos 为使用静态 IP1 修改网络配置 {代码...} 修改后的内容如下 {代码...} 2 重启网络服务 {代码...} 3 查看地址 {代码...} 参考来源:[链接]
青阳半雪阅读 1.8k评论 3
数据结构与算法:二分查找
一、常见数据结构简单数据结构(必须理解和掌握)有序数据结构:栈、队列、链表。有序数据结构省空间(储存空间小)无序数据结构:集合、字典、散列表,无序数据结构省时间(读取时间快)复杂数据结构树、 堆图二...
白鲸鱼赞 9阅读 5.4k
滚蛋吧,正则表达式!
你是不是也有这样的操作,比如你需要使用「电子邮箱正则表达式」,首先想到的就是直接百度上搜索一个,然后采用 CV 大法神奇地接入到你的代码中?
良许赞 3阅读 1.6k
搭个ChatGPT算法模型,从哪开始?
最近 ChatGPT 很火,火到了各行各业。记得去年更多的还是码农最新体验后拿它搜代码,现在各行各业都进来体验,问它咋理财、怎么写报告和给小孩起名。😂 也因此让小傅哥在头条的一篇关于 ChatGPT 的文章都有了26万...
小傅哥赞 6阅读 1.4k
程序员适合创业吗?
大家好,我是良许。从去年 12 月开始,我已经在视频号、抖音等主流视频平台上连续更新视频到现在,并得到了不错的评价。每个视频都花了很多时间精力用心制作,欢迎大家关注哦~考虑到有些小伙伴没有看过我的视频,...
良许赞 3阅读 1.3k
PyCharm 激活破解教程, 2023 年 2 月亲测有用
本文分享一下PyCharm 2022.2.3 版本最新激活破解教程,注意不要使用太新的版本,都是 Jetbrains 产品,本文专门配上了 Pycharm 的图片,跟着下面教程一步一步来即可。
程序员徐公阅读 11.1k评论 1
Ubuntu20.04 从源代码编译安装 python3.10
Ubuntu 22.04 Release DateUbuntu 22.04 Jammy Jellyfish is scheduled for release on April 21, 2022If you’re ready to use Ubuntu 22.04 Jammy Jellyfish, you can either upgrade your current Ubuntu syste...
ponponon赞 1阅读 4.6k评论 1
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。