ubuntu14.04下python+Theano+cuba7.5

来源:互联网 发布:java 多线程http代理 编辑:程序博客网 时间:2024/06/10 13:58

因为用的笔记本,因为用的wifi,所以这是一段非常曲折的历程。

1.使用wifi推荐在win下好了用U盘送到Ubuntu上。

2.推荐下载deb文件,比很多教程里面的run文件要简单很多。

3.Python->一些库->Theano->cuba,最好不要先装IDE

不然倒时候你装caffe 什么的时候,有的会装在2.*下有的装在3.*下

卸载的语句

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo apt-get autoremove python3.4  



教程如下,最好一步步来

1.安装相关软件包

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo apt-get install -y libopenblas-dev liblapack-dev libatlas-base-dev  

2.安装NumPy,并进行测试

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo pip install numpy  


[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. python -c 'import numpy; numpy.test()'  


3.安装SciPy并进行测试

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo pip install scipy  


[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. python -c 'import scipy; scipy.test()'  



4.安装Theano

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo pip install Theano  

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo python -c 'import theano; theano.test()'  
这个测试过程比较长,中间有一些小错误不必在意


5.安装cuda

最搞的一部来了,网上很多方法都是用run file,很麻烦阿

而且不知道为什么我没有成果,下面介绍deb file

进入CUDA Toolkit下载页面

选择如下:


a.

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. cd 你的deb文件所在的文件夹  

b.安装

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo dpkg -i cuda-repo-文件名   
我的是:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb     

c.更新本地仓库

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo apt-get update    


d.开始安装

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo apt-get install cuda  

e.环境变量设置

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. $ export PATH=/usr/local/cuda-7.5/bin:$PATH    
  2. $ export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH    



6.验证阶段


a.查看NVCC版本

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. nvcc -V  


b.编译并运行例子

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. cuda-install-samples-7.5.sh  ~   
  2. cd ~/NVIDIA_CUDA-7.5_Samples /  
  3. make  



d.编译完成后,进入你的deviceQuery 文件所在的目录

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <pre name="code" class="html">cd ~/NVIDIA_CUDA-6.5_Samples/bin  
然后运行deviceQuery 文件

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. ./ deviceQuery   



注:

我在使用过程中出现了

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. ValueError: Unable to create the compiledir directory '/home/pimengting/.theano/compiledir_Linux-3.13--generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64'. Check the permissions.  



解决办法

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. cd /home/你的用户名/  
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. sudo rm -r .theano  

0 0
原创粉丝点击