测试引入TensorFlow模块时提示的一些错误# import tensorflow as tf ERROR

问题:
应用系统中已经安装的python时,系统提示的gcc 版本 和 gcc --version 显示的版本不一致。
其实系统里已经安装过新版的gcc-6.1.0了。

是因为python之前用gcc4.47编译的,升级之后没有重新编译,现在重新编译一下,就正确了。


问题:import tensorflow as tf 报错:
Regression: PyUnicodeUCS4_AsUTF8String on 0.11.0rc0 to 0.11.0rc2 

IIRC it means that cairo was compiled against a Python compiled with --enable-unicode=ucs4. But the version of Python
you have was not (default is ucs2). 
Maybe you can find a different version/packaging of cairo that matches this. 

# cd Python-2.7
# ./configure --eanble-unicode=ucs4
完美解决问题


问题:import TensorFlow as tf
Importing the multiarray numpy extension module failed.
Original error was: /usr/local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol:
PyUnicodeUCS2_FromObject

Rebuild NumPy against a Python built as UCS-4

解决办法:
开始我想通过下载numpy 的源码,自己编译安装,但是官方文档并不推荐这么安装,而且编译过程中也确实出现了
一些安装意外的安装困难。
最后,我决定试一下通过重新编译过的python 重新编译pip 然后再通过pip 安装numpy scipy 等tensorflow 运行需要的相关依赖库。
# cd pip-18.0
# python setup.py build
# python setup.py install

# pip install numpy scipy 
最终提示安装成功,并且可以成功执行
# import tensorflow as tf
# print tf.__version__ 
显示返回 '1.6.0'
至此TensorFlow 才算正式安装成功。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值