问题:
应用系统中已经安装的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 才算正式安装成功。