栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

忽略surepip失败pip在Ubuntu 18.04中要求ssl / tls错误

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

忽略surepip失败pip在Ubuntu 18.04中要求ssl / tls错误

这是由于

Debian 9
使用
OpenSSL 1.1.0
,然而,
OpenSSL 1.1.0
在SSL模块,支持只加入到了Python
2.7.13
3.5.3
并且
3.6+

因此,它使那些版本下的蟒蛇不能正确链接到
ssl
库。问题https://github.com/pyenv/pyenv/issues/945
因此,在编译它们时必须手动添加这些库。


我的建议

由于您的系统已经使用默认的python进行编译,因此无意中将不同版本的python编译为

global
可执行文件可能会导致许多隐藏的问题,尤其是在系统默认python后面使用的某些命令。

那么,为什么不使用

pyenv
来控制那些python版本呢?
pyenv
就像是一个Python版本的控制程序,它使用
shims
,通过一个名为老调重弹的过程,
pyenv
维持
shims
在该目录中跨的每一个安装的版本每个Python命令匹配
python
pip
等。有关更多文档,请阅读:https
:
//github.com/pyenv/pyenv。要进行安装
pyenv
,请遵循提供的参考。

经过许多小时的努力,我终于找到了一种解决方案,可以完美地解决这些版本的python冲突问题,将以下脚本复制并粘贴到新文件中,并使其可执行,然后可以编译并安装这些python。如果您想以其他方式安装它们,例如,不使用

pyenv
,请更改最后第二行命令以适合您的需求。

#!/bin/bash -e# Note: it is a script to solve Ubuntu 18.04 LTS #       different version of pythons compiling#       header confliction problems## The idea is got from @JustAnotherArivist# From URL: https://github.com/pyenv/pyenv/issues/945## The script used in here is with slightly modifications# to fit many different SSL header versions# First under your home directory make OpenSSL library# and extract useful packagemkdir ~/libssl1.0-devcd ~/libssl1.0-devapt-get download libssl1.0-devar x libssl1.0-dev* data.tar.xztar -xf data.tar.xz --strip-components=2# Second, specifically get your current system's SSL headers# and make symbolic-linkslibcrypto=$(ls /usr/lib/x86_64-linux-gnu/ | grep libcrypto.so......)libssl=$(ls /usr/lib/x86_64-linux-gnu/ | grep libssl.so......)ln -s /usr/lib/x86_64-linux-gnu/${libcrypto} ~/libssl1.0-dev/lib/x86_64-linux-gnuln -s /usr/lib/x86_64-linux-gnu/${libssl} ~/libssl1.0-dev/lib/x86_64-linux-gnu# Set your CFLAGS LDFLAGS compile options# And use pyenv install the python version <3.4.5 or <3.5.3# Note: it is a one line command# Please change the version of python that you want to compileCFLAGS="-I${HOME}/libssl1.0-dev/include -I${HOME}/libssl1.0-dev/include/x86_64-linux-gnu" LDFLAGS="-L${HOME}/libssl1.0-dev/lib/x86_64-linux-gnu" pyenv install 3.4.2# Remove tempor libssl1.0-dev direcotoryrm -rf ~/libssl1.0-dev


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/375775.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号