Pyenv: 3.2安装失败并显示SSL错误

创建于 2013-05-22  ·  23评论  ·  资料来源: pyenv/pyenv

pyenv install命令在安装3.2时失败,但在3.2.5和3.1.5中成功:

ubuntu<strong i="7">@box144</strong>:~$ pyenv install 3.1.5
Downloading Python-3.1.5.tgz...
-> http://www.python.org/ftp/python/3.1.5/Python-3.1.5.tgz
Installing Python-3.1.5...
Installed Python-3.1.5 to /home/ubuntu/.pyenv/versions/3.1.5

Downloading distribute-0.6.40.tar.gz... [...]
Downloading pip-1.3.1.tar.gz... [...]

ubuntu<strong i="8">@box144</strong>:~$ pyenv install 3.2.5
Downloading Python-3.2.5.tgz...
-> http://yyuu.github.io/pythons/ed8d5529d2aebc36b53f4e0a0c9e6728
Installing Python-3.2.5...
Installed Python-3.2.5 to /home/ubuntu/.pyenv/versions/3.2.5

Downloading distribute-0.6.40.tar.gz... [...]
Downloading pip-1.3.1.tar.gz... [...]

ubuntu<strong i="9">@box144</strong>:~$ pyenv install 3.2
Downloading Python-3.2.tgz...
-> http://yyuu.github.io/pythons/5efe838a7878b170f6728d7e5d7517af
Installing Python-3.2...

BUILD FAILED

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

Last 10 log lines:
  File "<string>", line 2, in <module>
  File "/home/ubuntu/.pyenv/versions/3.2/lib/python3.2/ssl.py", line 60, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
ImportError: The Python ssl extension was not compiled. Missing the OpenSSL lib?

最有用的评论

建议再次调查该票证,无法在安装了homebrew openssl的情况下安装新的python。

遇到完全相同的问题并找到了这张票:

$ brew upgrade pyenv
Error: pyenv-20140211 already installed
$ pyenv install 2.7.4
....
BUILD FAILED

Inspect or clean up the working tree at /var/folders/3y/7jrv6jr95fnbs9rr0vx1xwzc0000gn/T/python-build.20140212160358.97455
Results logged to /var/folders/3y/7jrv6jr95fnbs9rr0vx1xwzc0000gn/T/python-build.20140212160358.97455.log

Last 10 log lines:
  File "<string>", line 1, in <module>
  File "/Users/doug/.pyenv/versions/2.7.4/lib/python2.7/ssl.py", line 60, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl

The Python ssl extension was not compiled. Missing the OpenSSL lib?

对我有用的是:

$ CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install 2.7.4

所有23条评论

这可能是使用最新版本的OpenSSL的ssl模块的构建问题。 我在SHA @ 5fbc3ae3d5629081507b691a3549007cff1cffc6中添加了补丁程序以防止此错误。

@notnoop
请尝试使用最新的master进行重建。

@notnoop
你不在吗

我已经关闭了此步骤,因为我已经确认机器上的构建问题已解决。

我也有同样的问题。 尚未解决。
我尝试通过自制软件安装openssl,但问题仍然存在。

@Rnhmjoj
您遇到了openssl问题哪个版本的Python? 请向我显示pyenv install --verbose ${version}的实际输出为要点。

@yyuu版本是版本:3.3.2。 这是日志

@Rnhmjoj
嗯...看起来有点奇怪:(

CPython 3.3.2的ssl模块的构建问题必须是另一个问题。 CPython 3.2上的问题是由OpenSSL的最新更改引起的(它取消了对SSLv2的支持)。

https://github.com/yyuu/pyenv/blob/master/plugins/python-build/share/python-build/patches/3.2/Python-3.2/001_openssl_no_ssl2.patch

尽管CPython 3.3.2是相当新的功能,并且默认情况下已应用了等效的修复程序,但这一定不是问题。

为了进一步调查,我想再解决您的问题。

建议再次调查该票证,无法在安装了homebrew openssl的情况下安装新的python。

遇到完全相同的问题并找到了这张票:

$ brew upgrade pyenv
Error: pyenv-20140211 already installed
$ pyenv install 2.7.4
....
BUILD FAILED

Inspect or clean up the working tree at /var/folders/3y/7jrv6jr95fnbs9rr0vx1xwzc0000gn/T/python-build.20140212160358.97455
Results logged to /var/folders/3y/7jrv6jr95fnbs9rr0vx1xwzc0000gn/T/python-build.20140212160358.97455.log

Last 10 log lines:
  File "<string>", line 1, in <module>
  File "/Users/doug/.pyenv/versions/2.7.4/lib/python2.7/ssl.py", line 60, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl

The Python ssl extension was not compiled. Missing the OpenSSL lib?

对我有用的是:

$ CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install 2.7.4

因此,我使用#22中的更改更新了2.7.6文件,但仍然收到与贝克最近的评论相同的错误。 我错过了一些简单的事情吗? 在MacOS Mavericks上。
刚运行“ pyenv install 2.7.6”

@yina最终我不得不沟自制的OpenSSL。
最终为我工作的是:

brew uninstall openssl
brew upgrade pyenv
pyenv install 2.7.6

谢谢贝克。 我应该澄清一下,我使用的是安装了openssl的macports。 我确实具有最新的pyenv,其中包含对2.7.6文件所做的更改的“ pyenv更新”。

最近的提交看起来好像将包含openssl(如果不可用),因此我将尝试sudo port uninstall openssl 。 并且如果其他项目需要openssl,请使用xcode附带的内容。 希望这可以帮助

@beck @yina
提交6b0710e263ee92a4ae15822e38b1037775d93609尚未合并到master 。 我想知道是否应该合并它,因为我可以通过在OS X Mavericks上针对OS X的默认OpenSSL 0.9.8进行链接来构建CPython 2.7.6。

请让我知道更多信息:

  1. 您安装了Command Line Tools for Xcode吗?
  2. 您的默认C编译器是什么? 您可以使用which cc; cc -v
  3. CFLAGSLDFLAGSCPPFLAGS的环境变量
  4. pyenv install -v 2.7.6 2>&1 | tee build.log的输出

@yyuu在您发表一些评论之后,我对构建环境进行了更仔细的观察,但我没有正确指定LDFLAGS和CPPFLAGS,因此它无法正常工作。 我将LDFLAGS和CPPFLAGS更新为

export LDFLAGS="-L/opt/local/lib" 
export CPPFLAGS="-I/opt/local/include"

然后跑

pyenv install -v 2.7.6

而且有效! 谢谢!

: 然后:

:恭喜您:

贝克的修复程序也对我有用,但我使用了brew的openssl
CFLAGS =“-I $(brew --prefix openssl)/ include” \
LDFLAGS =“-L $(brew --prefix openssl)/ lib” \
pyenv安装2.7.4

在优胜美地10.10.x和自制软件openssl 1.0.2d中,我不得不将以前的oneliner更改为:
LDFLAGS="-L$(brew --prefix openssl)/lib" CPPFLAGS="-I$(brew --prefix openssl)/include" pyenv install 2.7.10

看来现在必须使用CPPFLAGS代替CFLAGS。

对我来说,我必须为openssl,zlib和sqlite3包含LDFLAGS和CPPFLAGS。

链接zlib和openssl的命令对我有用: CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib" CPPFLAGS="-I$(brew --prefix openssl)/include" pyenv install -v 3.5.0

我只是升级到El Capitan 10.11。

我也有ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

我正在运行全新安装的El Capitan 10.11,而不是升级。 我已经尝试了上述所有解决方案,与Wiki故障排除相同,但仍然遇到相同的错误。

这是完整的错误(如果您愿意,我也可以将完整的日志记录如下):

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/yyuu/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.11 using python-build 20150818)

Inspect or clean up the working tree at /var/folders/0f/z22q_whs0v30pr8lg6b_jfxr0000gn/T/python-build.20151003143338.30855
Results logged to /var/folders/0f/z22q_whs0v30pr8lg6b_jfxr0000gn/T/python-build.20151003143338.30855.log

Last 10 log lines:
rm -f /Users/gabo/.pyenv/versions/2.7.10/share/man/man1/python.1
(cd /Users/gabo/.pyenv/versions/2.7.10/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno"  ; then \
        case no in \
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi

与干净的El Capitan相同的错误在这里:

Stefans-MBP:~ stefan$ pyenv install 3.4.3
Downloading readline-6.3.tar.gz...
-> https://yyuu.github.io/pythons/56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43
Installing readline-6.3...
Installed readline-6.3 to /Users/stefan/.pyenv/versions/3.4.3

Downloading Python-3.4.3.tgz...
-> https://yyuu.github.io/pythons/4281ff86778db65892c05151d5de738d
Installing Python-3.4.3...
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/yyuu/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.11 using python-build 20150818)

Inspect or clean up the working tree at /var/folders/v5/rk06g5z94txf2fglhrk9b3y40000gn/T/python-build.20151004141807.591
Results logged to /var/folders/v5/rk06g5z94txf2fglhrk9b3y40000gn/T/python-build.20151004141807.591.log

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

@MrLeeh在El Capitan工作。

$ xcode-select --install
$ brew uninstall openssl
$ pyenv install 3.4.0

Downloading openssl-1.0.1p.tar.gz...
-> https://yyuu.github.io/pythons/bd5ee6803165c0fb60bbecbacacf244f1f90d2aa0d71353af610c29121e9b2f1
Installing openssl-1.0.1p...
Installed openssl-1.0.1p to /Users/CHANN/.pyenv/versions/3.4.0

Downloading Python-3.4.0.tgz...
-> https://yyuu.github.io/pythons/d2c83ea0217769a73e8b1ee33ffbca814903f8568e30f8d13e68e3d1f743449c
Installing Python-3.4.0...
Installed Python-3.4.0 to /Users/CHANN/.pyenv/versions/3.4.0

真好! 在尝试了“通用构建问题”维基上的所有其他问题之后,第448号问题(尽管未尝试使用Copperlight的确切命令),第451号问题都没有成功,channprj的上述解决方案为我工作。 OS 10.11,El Capitan。 谢谢!

$ brew卸载openssl
$ brew卸载--force openssl
$ pyenv安装2.7.10

正在下载openssl-1.0.1p.tar.gz ...
-> https://yyuu.github.io/pythons/bd5ee6803165c0fb60bbecbacacf244f1f90d2aa0d71353af610c29121e9b2f1
正在安装openssl-1.0.1p ...
将openssl-1.0.1p安装到/Users/tylerarbour/.pyenv/versions/2.7.10

正在下载Python-2.7.10.tgz ...
-> https://yyuu.github.io/pythons/eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a
安装Python-2.7.10 ...
修补文件./Lib/site.py
将Python-2.7.10安装到/Users/tylerarbour/.pyenv/versions/2.7.10

此页面是否有帮助?
0 / 5 - 0 等级