今天运行一个python3写的深度学习的程序。遇到了如下的问题
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/theano/gof/lazylinker_c.py", line 92, in
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./demo.py", line 4, in
import training
File "/home/jdlu/2017/vector/training.py", line 9, in
import keras
File "/usr/local/lib/python3.6/site-packages/keras/__init__.py", line 3, in
from . import activations
File "/usr/local/lib/python3.6/site-packages/keras/activations.py", line 4, in
from . import backend as K
File "/usr/local/lib/python3.6/site-packages/keras/backend/__init__.py", line 80, in
from .theano_backend import *
File "/usr/local/lib/python3.6/site-packages/keras/backend/theano_backend.py", line 3, in
import theano
File "/usr/local/lib/python3.6/site-packages/theano/__init__.py", line 66, in
from theano.compile import (
File "/usr/local/lib/python3.6/site-packages/theano/compile/__init__.py", line 10, in
from theano.compile.function_module import *
File "/usr/local/lib/python3.6/site-packages/theano/compile/function_module.py", line 21, in
import theano.compile.mode
File "/usr/local/lib/python3.6/site-packages/theano/compile/mode.py", line 10, in
import theano.gof.vm
File "/usr/local/lib/python3.6/site-packages/theano/gof/vm.py", line 662, in
from . import lazylinker_c
File "/usr/local/lib/python3.6/site-packages/theano/gof/lazylinker_c.py", line 127, in
preargs=args)
File "/usr/local/lib/python3.6/site-packages/theano/gof/cmodule.py", line 2316, 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: could not read symbols: Bad value. collect2: error: ld returned 1 exit status.
解决方案:
1)官网下载Python3的代码
2)使用如下命令来生成Makefile
./configure --enable-shared CFLAGS=-fPIC --enable-optimizations
3)重新编译、安装
make install
阅读(1578) | 评论(0) | 转发(0) |