簡體   English   中英

在Archlinux上通過Pyenv編譯Python但缺少OpenSSL

[英]Compiling Python via Pyenv on Archlinux but missing OpenSSL

我想在我的新ArchLinux安裝上通過pyenv安裝python

pyenv install 3.5.1Downloading Python-3.5.1.tar.xz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
Installing Python-3.5.1...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

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


BUILD FAILED (Arch Linux using python-build 20160602)

Inspect or clean up the working tree at /tmp/python-build.20170515113212.3725
Results logged to /tmp/python-build.20170515113212.3725.log

Last 10 log lines:
(cd /home/maximilian/.pyenv/versions/3.5.1/share/man/man1; ln -s python3.5.1 python3.1)
if test "xupgrade" != "xno"  ; then \
    case upgrade in \
        upgrade) ensurepip="--upgrade" ;; \
        install|*) ensurepip="" ;; \
    esac; \
     ./python -E -m ensurepip \
        $ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS

由於缺少OpenSSL支持,它很容易失敗。 我在之前的Arch安裝上運行它,但我不記得我當時做了什么。

Wiki中的FAQ不提供可行的解決方案

請試一試:

CFLAGS=-I/usr/include/openssl-1.0 \
LDFLAGS=-L/usr/lib64/openssl-1.0 \
pyenv install -v 3.5.1

ArchLinux包:

$ pacman -Q | grep openssl
openssl 1.1.0.e-1
openssl-1.0 1.0.2.k-3
python-pyopenssl 17.0.0-1
python2-pyopenssl 17.0.0-1

pyvenv常見問題解答提到了與您報告的內容類似的問題 他們的解決方案是使用

CFLAGS=-I/usr/include/openssl \
LDFLAGS=-L/usr/lib64 \
pyenv install -v 3.5.1

此外,不是Python需要SSL而只是pip。 Arch自己的Python 3軟件包使用--without-ensurepip編譯 ,所以你可以試試

CONFIGURE_OPTS="--without-ensurepip" \
pyenv install -v 3.5.1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM