gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 14:06:37 42 4
gpt4 key购买 nike

我阅读了以下说明,以便使用 matlab 代码创建 python 应用程序:Create a Python Application with MATLAB Code

一切正常,当我执行命令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'

然后,当我尝试导入 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.

如何解决这个问题?

最佳答案

这个错误是不言自明的。必须定义环境变量LD_LIBRARY_PATH,以便操作系统知道库的位置。使用setenv command正确定义它,如下所示:

setenv LD_LIBRARY_PATH path/to/libraries

看来this link可以为您指明正确的路径(没有双关语),并且所需位置的格式为 matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

关于python - 使用 MATLAB 代码创建 python 应用程序时出错 (LD_LIBRARY_PATH),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48844547/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com