参考文献:jteng的专栏-http://blog.csdn.net/jteng/article/details/52075871
根据jteng分享的安装步骤,第一次安装并没有成功。
XXX:~$ python
Python 2.7.13 |Anaconda 4.4.0 (64-bit)| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import theano
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/seanow/anaconda2/lib/python2.7/site-packages/theano/__init__.py", line 45, in <module>
from theano.configdefaults import config
File "/home/seanow/anaconda2/lib/python2.7/site-packages/theano/configdefaults.py", line 17, in <module>
from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
File "/home/seanow/anaconda2/lib/python2.7/site-packages/theano/configparser.py", line 86, in <module>
theano_cfg.read(config_files)
File "/home/seanow/anaconda2/lib/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/home/seanow/anaconda2/lib/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /home/seanow/.theanorc, line: 1
'\xe2\x80\x83\xe2\x80\x83[global]\n'
>>>
分析错误原因:
安装环境区别如下:
jteng的安装环境:Ubuntu16.04lts 64位系统,NVIDIA Geforce 840M,Anaconda Python 3.5,Cuda7.5。
我的安装环境:Ubuntu16.04lts 64位系统,NVIDIA Geforce 965M,Anaconda Python 2.7,Cuda7.5。
当运行以下代码时,出现以下问题:
XXX:~$ sudo gedit ~/.theanorc
[sudo] XXX 的密码:
(gedit:10052): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
** (gedit:10052): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-spell-enabled
** (gedit:10052): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-encoding
** (gedit:10052): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-position
百度之后:https://askubuntu.com/questions/419783/gtk-warning-calling-inhibit-failed-gdbus-errororg
看到类似问题,大神给的答案是:use gksudo
or gksu
instead of sudo to open the file,
XXX:~$ gksudo gedit ~/.theanorc
程序“gksudo”尚未安装。 您可以使用以下命令安装:
sudo apt install gksu
………………………………………………
(安装过程)
………………………………………………
XXX:~$ gksudo gedit ~/.theanorc
** (gedit:10924): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-spell-enabled
** (gedit:10924): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-encoding
** (gedit:10924): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-position
此时,第一个错误消失。后几个问题经多处查询,未找到合适答案,未能解决。网友提示可以忽略,事实的确不影响后续结果,但希望有高手给予解决。
再次运行 import theano
Using gpu device 0: GeForce GTX 965M (CNMeM is disabled, cuDNN not available)
表明安装成功!