简体   繁体   English

使用 MATLAB 代码 (LD_LIBRARY_PATH) 创建 python 应用程序时出错

[英]Error creating python application with MATLAB code (LD_LIBRARY_PATH)

I read the following instructions in order to create a python application using matlab code: Create a Python Application with MATLAB Code为了使用 matlab 代码创建 Python 应用程序,我阅读了以下说明:使用 MATLAB 代码创建 Python 应用程序

Everything is ok, when I execute the command python setup.py install the following message shows up:一切正常,当我执行命令python setup.py install出现以下消息:

root@david:/home/david/Desktop/Matrices_Clifford/for_redistribution_files_only# python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/Matrices_Clifford
copying Matrices_Clifford/__init__.py -> build/lib.linux-x86_64-2.7/Matrices_Clifford
copying Matrices_Clifford/Matrices_Clifford.ctf -> build/lib.linux-x86_64-2.7/Matrices_Clifford
running install_lib
creating /usr/local/lib/python2.7/dist-packages/Matrices_Clifford
copying build/lib.linux-x86_64-2.7/Matrices_Clifford/Matrices_Clifford.ctf -> /usr/local/lib/python2.7/dist-packages/Matrices_Clifford
copying build/lib.linux-x86_64-2.7/Matrices_Clifford/__init__.py -> /usr/local/lib/python2.7/dist-packages/Matrices_Clifford
byte-compiling /usr/local/lib/python2.7/dist-packages/Matrices_Clifford/__init__.py to __init__.pyc
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/matlabruntimeforpython-R2017a.egg-info
Writing /usr/local/lib/python2.7/dist-packages/matlabruntimeforpython-R2017a.egg-info
removing 'build/lib.linux-x86_64-2.7' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
removing 'build'

Then, when I try to import Matrices_Clifford there is an error:然后,当我尝试导入 Matrices_Clifford 时出现错误:

import Matrices_Clifford
    Exception caught during initialization of Python interface. Details: On Linux, you must set the environment variable "LD_LIBRARY_PATH" to a non-empty string. For more details, see the package documentation.
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "Matrices_Clifford/__init__.py", line 276, in <module>
        _pir.get_paths_from_os()
      File "Matrices_Clifford/__init__.py", line 171, in get_paths_from_os
        friendly_os_name, self.path_var, 'For more details, see the package documentation.'))
    RuntimeError: On Linux, you must set the environment variable "LD_LIBRARY_PATH" to a non-empty string. For more details, see the package documentation.

How can I fix this problem?我该如何解决这个问题?

The error is quite self-explanatory.该错误是不言自明的。 The environment variable LD_LIBRARY_PATH must be defined so that the operating system knows the location of the libraries.必须定义环境变量LD_LIBRARY_PATH以便操作系统知道库的位置。 Use the setenv command to define it properly, as follows:使用setenv命令正确定义,如下:

setenv LD_LIBRARY_PATH path/to/libraries

It seems that this link can point you to the right path (no pun intended) and that the required location is in the form of matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64 . 这个链接似乎可以指向正确的路径(没有双关语),并且所需的位置是matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM