Ubuntu16使用theano出错
最近看了一篇paper,在复现论文代码时,需要用到theano这个机器学习工具(感觉我看了好多个工具,但却都只是了解,好悲伤!!!),然后再本地的Ubuntu16虚拟机里面装这个工具,用一下指令:
sudo pip3 install theano
因为之前我装过TensorFlow和Pytorch,所以一些依赖包基本已经包括了。我安装的theano版本是1.0.1,python是3.6。
提示安装成功之后,开始跑代码,但是却出现一下错误:
You can find the C code in this temporary file: /tmp/theano_compilation_error_jj1i_fkk
Traceback (most recent call last):File "/usr/local/lib/python3.6/site-packages/theano/gof/lazylinker_c.py", line 75, in <module>raise ImportError()
ImportErrorDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/local/lib/python3.6/site-packages/theano/gof/lazylinker_c.py", line 92, in <module>raise ImportError()
ImportErrorDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "filter_noise_embs.py", line 3, in <module>import theanoFile "/usr/local/lib/python3.6/site-packages/theano/__init__.py", line 110, in <module>from theano.compile import (File "/usr/local/lib/python3.6/site-packages/theano/compile/__init__.py", line 12, in <module>from theano.compile.mode import *File "/usr/local/lib/python3.6/site-packages/theano/compile/mode.py", line 11, in <module>import theano.gof.vmFile "/usr/local/lib/python3.6/site-packages/theano/gof/vm.py", line 673, in <module>from . import lazylinker_cFile "/usr/local/lib/python3.6/site-packages/theano/gof/lazylinker_c.py", line 127, in <module>preargs=args)File "/usr/local/lib/python3.6/site-packages/theano/gof/cmodule.py", line 2359, in compile_str(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): /usr/bin/ld:
/usr/local/lib/libpython3.6m.a(abstract.o):
relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used
when making a shared object; recompile with -fPIC. /usr/local/lib/libpython3.6m.a:
无法添加符号: 错误的值. collect2: error: ld returned 1 exit status.
这种提示错误一般是一层一层抛出,所以只需要看最里面那行错误:
Exception: Compilation failed (return status=1): /usr/bin/ld:
/usr/local/lib/libpython3.6m.a(abstract.o):
relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used
when making a shared object; recompile with -fPIC.
/usr/local/lib/libpython3.6m.a: 无法添加符号: 错误的值. collect2: error: ld returned
1 exit status.
大致意思是编译出错,有个东西无法使用,需要用-fPIC模式进行编译。看完之后,查了一下资料,发现是之前编译python3的时候选项没有选正确,出现了无法支持当前的编译,需要对Python重新编译。
查阅资料,发现应该按以下方式对Python3进行编译安装:
./configure --enable-shared CFLAGS=-fPIC
make
sudo make install
对于./configure
后面的选项,可以通过./configure -help
来进行了解。上面的编译带上了可以共享选项。
安装完之后,试一试效果,发现连python3都会出错了(有点小崩溃),出现以下错误:
python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared
object file: No such file or directory
说找不到libpython3.6m.so.1.0
文件。
运行ldd /usr/local/bin/python3
,看看python3运行所需要的库,结果显示如下:
linux-vdso.so.1 => (0x00007fff70da5000)
libpython3.6m.so.1.0 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1496ff1000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1496c27000)
/lib64/ld-linux-x86-64.so.2 (0x00007f149720e000)
发现那个依赖文件的确没有找到.。
查找一下文件的位置:
find /-name 'libpython3.3m.so.1.0'
文件位置为:
/usr/local/lib/libpython3.6m.so.1.0
之后在目录/etc/ld.so.conf.d
下,建立python3.conf
文件
cd /etc
cd ld.so.conf.d
sudo touch python3.conf
然后编辑该文件,加入libpython3.6m.so.1.0
文件所在的目录
sudo gedit python3.conf #编辑文件/usr/local/lib/ #加入文件所在的目录
最后运行:sudo ldconfig
再运行python3,问题解决.
再运行theano时,仅仅提示:
WARNING (theano.tensor.blas): Using NumPy C-API based implementation
for BLAS functions.
并没有出现错误,问题解决!!!
Ubuntu16使用theano出错相关推荐
- 深度学习(四十一)cuda8.0+ubuntu16.04+theano、caffe、tensorflow环境搭建
cuda8.0+ubuntu16.04+theano.caffe.tensorflow环境搭建 目前自己撘过深度学习各种库.各种环境,已经搭建了n多台电脑,发现每台电脑配置安装方法各不相同,总会出现各 ...
- Ubuntu16.04+Theano环境
安装Anaconda: 官网下载Anaconda 切换到下载目录 cd ~/下载/ 用bash运行下载好的.sh文件 bash Anaconda2-4.3.0-Linux-x86_64.sh 进入欢迎 ...
- ubuntu16.04 编译出错:fatal error: SDL/SDL.h: No such file or directory
在ubuntu 16.04编译神经网络代码时候,遇到了这样一种错误? fatal error: SDL/SDL.h: No such file or directory 原因是SDL库没有安装,根据你 ...
- Ubuntu16.04安装搜狗输入法的正确姿势
安装搜狗输入法的正确姿势 一.下载搜狗Linux: 二.安装命令 三.卸载fcitx-ui-qimpanel 四.重启系统 + 导入sougou输入法 五.其他报错问题解决方法: 1.Errors w ...
- Caffe+Kubuntu16.04_X64+CUDA 8.0配置
前言: 经过尝试过几次Caffe,theano,MxNet之后,很长时间没有进行caffe的更新,此次在Ubuntu16.04下安装Caffe,折腾了一天时间,终于安装成功. 参考链接:Caffe+U ...
- hjimce算法类博文目录
hjimce算法类博文目录 个人博客:http://blog.csdn.net/hjimce 个人qq:1393852684 知乎:https://www.zhihu.com/people/huang ...
- 零基础安装戴尔服务器并安装ubuntu14.04使用教程 (PowerEdge R730/R730xd)
实验室有一台服务器,放置了两年,没有人弄,于是零基础的我搞了一个星期.现在把安装使用教程记录下来,方便以后不在实验室之后,方便有人接手. 所需软件下载百度网盘: 链接:https://pan.baid ...
- Ubuntu16.04 +cuda8.0+cudnn+opencv+caffe+theano+tensorflow配置明细
本文为原创作品,未经本人同意,禁止转载,禁止用于商业用途!本人对博客使用拥有最终解释权 欢迎关注我的博客:http://blog.csdn.net/hit2015spring和http://www.c ...
- 详细安装指南-Ubuntu16.04,CUDA8.0,Caffe,OpenCV3.1,Theano,Tensorflow,纯属转载,等待自己修改
服务器系统崩溃,买的组装服务器不靠谱啊,售后很热情,但是技术... Ubuntu16.04 Ubuntu16.04就自己装吧,这个省略.安装完成之后,根据自己实际情况,配置一下怎么上网.之后,更新源, ...
最新文章
- 13.执行外部命令subprocess
- C语言中前面有四个空格,在C语言编程中什么叫前导空格,什么叫尾随空 – 手机爱问...
- html设置excel打开新窗口,怎么在excel的大页面上设置第几页第几页的
- final+static
- 声明 static 变量注意事项
- 基于连续小波变换和卷积神经网络的轴承故障诊断研究
- efcore微软官方文档
- 2012-2013最新泰晤士报和QS世界大学排名前100名单对比
- FreeTextBox编辑框遇到的问题
- CITA架构与云计算服务
- c++获取系统时间实例2
- 好用的vue组件插件及框架
- ORACLE 习题(一)
- tcc275CAN报文发送多帧只发送一帧的原因
- PRI变换法原理解析及其matlab分析
- 拓臻生物任命Senthil Sundaram为首席执行官、Mark Vignola, Ph.D.为首席财务官、Erin Quirk, M.D.为总裁
- 中国海洋大学计算机科学与技术考研科目,中国海洋大学(专业学位)计算机技术研究生考试科目和考研参考书目...
- 微信公众平台开发(3)--成为开发者并购置服务器环境
- 大数据学习(spark的三个样例编程)
- Mac如何连接HP激光打印机(HP LaserJet 1020)
热门文章
- WorkFlow入门Step.7—Creating a FlowChart WorkFlow-For-WF4.0
- 数据访问基础类(基于Access数据库)
- DreamFactory 第9章 性能注意事项
- Hibernate Tomcat JNDI DataSource示例教程
- 数据可视化组件Grafana详细解读--RedHat/Fedora/CentOS/Oracle上的安装
- Mac或者Linux安装RabbitMQ
- wdinow 下 使用 docker 安装 code-server (web 版 vscode)
- shell find命令 文件夹查询关键字 查询结果输出新文件
- docker集群理解
- python之质数判断