jacktangj 2018-07-03
在mac上安装一些python库报错,如下:
SWIG/_m2crypto.i:54: Error: Unable to find 'openssl/opensslv.h'
SWIG/_m2crypto.i:60: Error: Unable to find 'openssl/safestack.h'
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_rc4.i:5: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
或:
build/temp.macosx-10.11-intel-2.7/_openssl.c:493:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
此原因产生,应该是openssl版本过低或位置未找到。
查看版本命令:openssl version
版本升级:
brew update
brew install openssl
安装结束后会显示安装位置,如:/usr/local/Cellar/openssl/1.0.2o_2: 1,792 files, 12.2MB
安装成功后进行软链:
sudo rm /usr/bin/openssl
sudo ln -s /usr/local/Cellar/openssl/1.0.2o_2/bin/openssl /usr/bin/openssl
此时openssl升级完成。
但是在进行软件安装时还是会报上面错误,说明openssl正确了,但是查询的openssl文件位置未变。执行如下命令安装:
sudo env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" pip install pyOpenSSL==17.1.0
perl Configure VC-WIN64A --prefix=C:\openssl_x64 no-asm no-shared enable-tlsext enable-static-engine