ubuntu 14.04安装tensorflow环境踩坑指南

ubuntu 14.04安装tensorflow环境踩坑指南

有话要说

上午手残点了Ubuntu推送的系统更新后,之前所有安装过的显卡驱动和cuda、tensorflow都没了,欲哭无泪从头再来安装,顺便改了一波系统用户名,于是以前多数都是一遍过的内容这次就光荣的踏上了趟坑之旅,谨以此文纪念一下。
各组件版本:
Ubuntu 14.04,GPU TITAN V,cuda 8.0,cudnn 6.0,Python 2.7,tensorflow 1.4.0

趟坑之旅

显卡驱动安装
使用如下命令关掉图形界面

sudo service lightdm stop

结果黑屏后除了屏幕左上角一直闪烁的光标,啥都没了,Ctrl+Alt+F1也没有任何反应,Ctrl+Alt+F7也回不去,怎么办,这也没办法安装显卡驱动啊?
没办法了,只好先重启。此时我的解决办法是先按Ctrl+Alt+F1进入命令行窗口,输入上面的命令,bingo,可以愉快的玩耍了;但是要记住,按了Ctrl+Alt+F1后,上面关闭图形界面的命令是不可少的,否则安装依旧出错。
如果还是出错,输入下面的命令,然后按照链接重新来一遍

sudo /usr/bin/nvidia-uninstall

cuda和cudnn安装
这里没啥问题,照着来就好。
tensorflow安装
这里平常比较简单,但谁让我是来踏坑的呢。
这里各种不知道什么的原因,tensorflow-gpu-1.4.0不让安装,显示版本不匹配,等等问题。已经过去比较久了,错误信息看不到了,但是下载的好多次,每次都下完了提示装不了。最后解决办法是——去清华源找到对应的版本(这里是2.7)下下来,输入下面的命令安装。

python -m pip install /home/cxy/anzhuangbao/tensorflow_gpu-1.4.0rc1-cp27-cp27mu-manylinux1_x86_64.whl

然而接下来才是痛苦的开始,缺各种whl包,下载慢不说,还装不上,一堆子这样的错误

 InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/26/57/69f35fa2ee411cfa3557efa40f776992dffb54d8edd52e03ec0be5fb3bb9/setuptools-39.0.0-py2.py3-none-any.whl (569kB)
     |████████████████████████████▊   | 512kB 3.6kB/s eta 0:00:16ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/install.py", line 345, in run
  ......

没办法,看到了链接,只好强行来了,先下下来,怼在一起安装,就像这样

python -m pip install /home/cxy/anzhuangbao/tensorflow_gpu-1.4.0rc1-cp27-cp27mu-manylinux1_x86_64.whl protobuf-3.9.1-cp27-cp27mu-manylinux1_x86_64.whl

其实装了两个之后基本就好了,后面的都可以直接下载安装了,就是稍微慢了一点,包都不打,还可以接受。
接下来就是下面的问题了,之前安装的时候也遇到过。这里同时出现的是两个问题。

ERROR: markdown 3.1.1 has requirement setuptools>=36, but you'll have setuptools 3.3 which is incompatible.
Installing collected packages: six, protobuf, werkzeug, markdown, futures, html5lib, bleach, tensorflow-tensorboard, funcsigs, mock, backports.weakref, enum34, tensorflow-gpu
 Found existing installation: six 1.5.2
ERROR: Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

第一个问题的参考解决办法在这
(https://blog.csdn.net/chengyq116/article/details/93654175)
不过我只用上了下面三句话就搞定

sudo apt-get remove python-setuptools
sudo apt-get remove --auto-remove python-setuptools
sudo pip install setuptools==39.0.0

第二个问题的解决比较简单,下面一行代码就解决了,当然链接不能丢,毕竟是人家的劳动成果。
(https://www.cnblogs.com/qq952693358/p/9425544.html)

sudo pip install six --upgrade --ignore-installed six

到这里基本就搞定了。
最后需要补充的一点是,换清华源速度很快,不是一般快

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值