Pyenv、Python安装失败:未安装OpenSSL开发头

Pyenv、Python安装失败:未安装OpenSSL开发头,python,macos,openssl,pyenv,Python,Macos,Openssl,Pyenv,我一直无法使用Pyenv在macOS(10.13.6)上安装Python,并且已经对常见的构建问题给出了详尽的建议 pyenv doctor报告:未安装OpenSSL开发标头。各种相关GitHub问题中建议的OpenSSL重新安装未起作用,没有各种标志设置,例如(在各种组合中): (在命令行put中也尝试了这些。) (通过自制试用了OpenSSL 1.02p和1.1) 尝试 及 及 及 不走运 brew link --force openssl 是不允许的(错误消息说要使用标志) 还尝试: $

我一直无法使用Pyenv在macOS(10.13.6)上安装Python,并且已经对常见的构建问题给出了详尽的建议

pyenv doctor报告:未安装OpenSSL开发标头。各种相关GitHub问题中建议的OpenSSL重新安装未起作用,没有各种标志设置,例如(在各种组合中):

(在命令行put中也尝试了这些。)

(通过自制试用了OpenSSL 1.02p和1.1)

尝试

不走运

brew link --force openssl
是不允许的(错误消息说要使用标志)

还尝试:

$(brew --prefix)/opt/openssl/bin/openssl
并在此处尝试了OpenSSL/macOS建议:

https://solitum.net/openssl-os-x-el-capitan-and-brew/
$PATH显示:

/usr/local/opt/openssl/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/.nvm/versions/node/v8.11.3/bin:/Users/tomclaburn/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/mongodb/bin:/usr/local/opt/openssl/bin/openssl:/usr/local/mongodb/bin:/usr/local/mongodb/bin
和.bash_配置文件包含:

if [ -d "${PYENV_ROOT}" ]; then
   export PATH="${PYENV_ROOT}/bin:${PATH}"
   eval "$(pyenv init -)"
   #eval "$(pyenv virtualenv-init -)"
fi
我怀疑有丢失/不正确的路径或链接,但我无法确定它可能是什么。欢迎提供任何建议

Pyenv错误输出: 构建失败(使用python构建20180424的OS X 10.13.6)

最后10行日志:

checking size of long... 0
checking size of long long... 0
checking size of void *... 0
checking size of short... 0
checking size of float... 0
checking size of double... 0
checking size of fpos_t... 0
checking size of size_t... configure: error: in `/var/folders/jb/h01vxbqs6z93h_238q61d48h0000gn/T/python-build.20180819081705.3009/Python-3.6.6':
configure: error: cannot compute sizeof (size_t)
pyenv医生错误输出:

checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for rl_gnu_readline_p in -lreadline... yes
checking for readline/readline.h... no
checking for SSL_library_init in -lssl... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... yes
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: OpenSSL development header is not installed.

如果这与我的问题相同,那是因为在你的路径中有一些不应该存在的头。运行
brew doctor
,您会看到它在抱怨。要解决此问题,您可以执行以下操作:

mkdir /tmp/includes
brew doctor 2>&1 | grep "/usr/local/include" | awk '{$1=$1;print}' | xargs -I _ mv _ /tmp/includes

在应用Kit的答案后;为了克服我还使用自制软件安装了
openssl
,我必须执行以下操作:

CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv doctor
这让我工作起来了。
还发现这对常见的构建问题很有用。

我很困惑。你想干什么?只需安装python?我正在尝试安装多个版本的python,使用Pyenv来管理它们。Python的单一版本不是问题。我在我的机器上使用了两个版本的Python。我必须使用虚拟环境让它们正常工作。我使用Python3.6和2.7,它们工作良好,配合良好。我使用的是python的Anaconda发行版,所以我不需要pyenv。有许多internet站点可以帮助您在mac上创建虚拟环境。这是一个无痛的任务使用蟒蛇和相当容易的其他方式。一些网站是:;这两个参考资料也解释了为什么最好使用VE的…@4thSpace-你是对的,
pyenv-doctor
选项不再可用。如果您仍然有问题,我的回答中的参考提供了其他选项。我已经将我的操作系统升级到macOS 10.15,不再有这个问题。答案被严重低估。我有这个问题已经一年了。
if [ -d "${PYENV_ROOT}" ]; then
   export PATH="${PYENV_ROOT}/bin:${PATH}"
   eval "$(pyenv init -)"
   #eval "$(pyenv virtualenv-init -)"
fi
checking size of long... 0
checking size of long long... 0
checking size of void *... 0
checking size of short... 0
checking size of float... 0
checking size of double... 0
checking size of fpos_t... 0
checking size of size_t... configure: error: in `/var/folders/jb/h01vxbqs6z93h_238q61d48h0000gn/T/python-build.20180819081705.3009/Python-3.6.6':
configure: error: cannot compute sizeof (size_t)
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for rl_gnu_readline_p in -lreadline... yes
checking for readline/readline.h... no
checking for SSL_library_init in -lssl... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... yes
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: OpenSSL development header is not installed.
mkdir /tmp/includes
brew doctor 2>&1 | grep "/usr/local/include" | awk '{$1=$1;print}' | xargs -I _ mv _ /tmp/includes
CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv doctor