简体   繁体   English

错误:未编译 Python ssl 扩展。 缺少 OpenSSL 库? (在 ubuntu 18.04 上安装 python 2.7)

[英]ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? (installing python 2.7 on ubuntu 18.04)

I keep getting this error when trying to install any version of Python 2.7.x using asdf version manager on Ubuntu 18.04.尝试在 Ubuntu 18.04 上使用asdf版本管理器安装任何版本的 Python 2.7.x 时,我不断收到此错误。 I have googled but there's a lot of answers that don't work.我用谷歌搜索过,但有很多答案不起作用。 How can I solve it?我该如何解决?

At the end of the error there's a link to this page在错误的末尾有一个指向此页面的链接

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

When you open that page it has first some solutions for Other *nix systems but for ubuntu you need to look deeper:当您打开该页面时,它首先有一些针对其他 *nix 系统的解决方案,但对于 ubuntu,您需要更深入地了解:

On Debian stretch (and Ubuntu bionic), libssl-dev is OpenSSL 1.1.x, but support for that was only added in Python 2.7.13, 3.5.3 and 3.6.0.在 Debian 延伸(和 Ubuntu 仿生)上,libssl-dev 是 OpenSSL 1.1.x,但仅在 Python 2.7.13、3.5.3 和 3.6.0 中添加了对它的支持。 To install earlier versions, you need to replace libssl-dev with libssl1.0-dev.要安装早期版本,您需要将 libssl-dev 替换为 libssl1.0-dev。 This is being tracked in https://github.com/pyenv/pyenv/issues/945 .这正在https://github.com/pyenv/pyenv/issues/945 中进行跟踪。

So if you don't need a specific version of 2.7 you can go ahead and install 2.7.13 and the error will not appear .因此,如果您不需要特定版本的 2.7,您可以继续安装2.7.13,并且不会出现错误 Or you can replace the library when installing dependencies.或者您可以在安装依赖项时替换库。

sudo apt-get install -y make build-essential libssl1.0-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev

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

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