我在服务器上使用Python模块Theano。它没有预装在那里,所以我把它和其他一些不在服务器上的模块一起安装在我的主文件夹中。当我在IPython中“导入theano”时,出现了以下错误。在
Problem occurred during compilation with the command line below:
g++ -shared -g -march=core2 -mcx16 -msahf -maes -mpclmul -mpopcnt -msse4.2 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=12288 -mtune=generic -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D NPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY -D NPY_ARRAY_ALIGNED=NPY_ALIGNED -D NPY_ARRAY_WRITEABLE=NPY_WRITEABLE -D NPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL -D NPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS -D NPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS -m64 -fPIC -I/apps/libs/python/2.7.3/lib/python2.7/site-packages/numpy/core/include -I/home/ext_sxc/include/python2.7 -o /home/ext_sxc/.theano/compiledir_Linux-2.6.32-431.1.2.0.1.el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.3-64/lazylinker_ext/lazylinker_ext.so /home/ext_sxc/.theano/compiledir_Linux-2.6.32-431.1.2.0.1.el6.x86_64-x86_64-with-centos-6.5-Final-x86_64-2.7.3-64/lazylinker_ext/mod.cpp -L/home/ext_sxc/lib -lpython2.7
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-1-3397704bd624> in <module>()
----> 1 import theano
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/__init__.pyc in <module>()
53 object2, utils
54
---> 55 from theano.compile import \
56 SymbolicInput, In, \
57 SymbolicOutput, Out, \
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/compile/__init__.py in <module>()
4 ViewOp, view_op, register_view_op_c_code)
5
----> 6 from theano.compile.function_module import *
7
8 from theano.compile.mode import *
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/compile/function_module.py in <module>()
16 from theano import gof
17 from theano.gof.python25 import partial
---> 18 import theano.compile.mode
19 from theano.compile.io import In, SymbolicInput, SymbolicInputKit, SymbolicOutput
20 from theano.compile.ops import deep_copy_op, view_op
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/compile/mode.py in <module>()
9 import theano
10 from theano import gof
---> 11 import theano.gof.vm
12 from theano.configparser import config, AddConfigVar, StrParam
13 from theano.compile.ops import register_view_op_c_code, _output_guard
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gof/vm.py in <module>()
514
515 try:
--> 516 import lazylinker_c
517
518 class CVM(lazylinker_c.CLazyLinker, VM):
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gof/lazylinker_c.py in <module>()
84 args = cmodule.GCC_compiler.compile_args()
85 cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
---> 86 preargs=args)
87 # Save version into the __init__.py file.
88 init_py = os.path.join(loc, '__init__.py')
/home/ext_sxc/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gof/cmodule.pyc in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module)
1969 # difficult to read.
1970 raise Exception('Compilation failed (return status=%s): %s' %
-> 1971 (status, compile_stderr.replace('\n', '. ')))
1972 elif config.cmodule.compilation_warning and compile_stderr:
1973 # Print errors just below the command line.
Exception: Compilation failed (return status=1): /usr/bin/ld: cannot find -lpython2.7. collect2: ld returned 1 exit status.
我怎样才能修正上面的错误?在
另一件事是,每当我在服务器上运行Python作业时,我首先执行
^{pr2}$在执行Python脚本之前,服务器的/usr/lib64文件夹中有libpython2.6.so。我认为这和问题有关。在
您的python安装未完成。当您这样做时:
将信息添加到环境变量中,以使您能够使用Python2.7.3。但是这个版本没有包含python的开发头(Theano需要这个)。或者它不能为你的环境提供正确的途径。在
要调试它,请在运行“module load libs/python/2.7.3”之前和之后运行此命令,以比较模块加载的作用:
^{pr2}$然后检查添加到env变量的路径并查看这些目录。它应该修改LD_LIBRARY_PATH变量,但也应该对LIBRARY_PATH做同样的修改。如果没有,请自己修改并告诉系统管理员。在
这会解决你的问题。在
否则,使用操作系统中的Python2.6,可能包含开发版本。在
否则,请通过模块检查其他python版本是否可用。在
最后,请联系您的系统管理员以添加python的开发和共享版本,或自行安装:
相关问题 更多 >
编程相关推荐