您的位置:首页 > 其它

Mac安装最新tensorflow遇到的坑,记录下方便后人

2018-03-03 01:30 288 查看
之前其他mac电脑安装tensorflow时候一切顺利,一行命令sudo pip install tensorflow就高搞定了,但是今天在新mac上安装tensorflow时候出现了一个bug,搞了半天终于搞完了。。。

网上还没啥相关解决措施,蛋碎一地,也没有相关用户po这问题,应该是新的tensorflow对mac的支持问题,废话不多说:

mac上pip安装tensorflow时候,会先安装所有依赖包

在安装其中依赖包grpcio时候出现:(就是这个grpcio,原来的tensorflow里面是不依赖这个的,现在才有的)

“”“DEPENDENCY ERROR

The target you are trying to run requires an OpenSSL implementation.
Your system doesn't have one, and either the third_party directory
doesn't have it, or your compiler can't build BoringSSL.

Please consult INSTALL to get more information.

If you need information about why these tests failed, run:

make run_dep_checks
”“”
显示mac系统上没有openssl

terminal敲openssl version
显示LibreSSL

网上查了下苹果已经放弃openssl,转向libressl了,但是在编译grpcio的时候仍需要openssl

解决措施:
1. 安装brew:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. 执行:brew install openssl

3. 添加环境变量: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

4. 再次执行openssl version 显示 OpenSSL, 执行 which openssl 显示 /usr/local/opt/openssl/bin/openssl

5. 执行:export LDFLAGS=-L/usr/local/opt/openssl/lib;export CPPFLAGS=-I/usr/local/opt/openssl/include, 为了编译时让编译器找到库和头文件所在位置

6. 重新执行sudo pip install grpcio,问题解决

7. 执行sudo pip install tensorflow,ok!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: