mac安装python库报openssl文件找不到

在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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值