在Python中导入Matlab引擎:找不到OSError版本“GLIBCXX_3.4.22”

2024-09-27 09:27:37 发布

您现在位置:Python中文网/ 问答频道 /正文

当我按照MathWorks页面(https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html)上的说明运行命令时 import matlab.engine 出现以下错误:

enter code here

runfile('/media/mattes/data1/dataDMattes/Code/Python/PythonProgram  /main.py', wdir='/media/mattes/data1/dataDMattes/Code/Python/PythonProgram')
Reloaded modules: shapely.geometry, shapely.algorithms.cga, fiona.compat, shapely.geometry.polygon, pyproj._proj, shapely.geometry.linestring, _proj, fiona._err, shapely.geometry.base, shapely.ftools, shapely.linref, shapely.ops, shapely.predicates, shapely.wkt, _internal, centerline.io, shapely.geometry.geo, shapely.topology, fiona.ogrext, mlarray, _internal.mlarray_utils, shapely.coords, shapely.affinity, shapely.geometry.collection, matlab, shapely.geometry.proxy, centerline.utils, shapely.ctypes_declarations, mlexceptions, fiona.rfc3339, fiona._geometry, shapely, _internal.mlarray_sequence, fiona._drivers, fiona.drvsupport, fiona, shapely.geometry.multipoint, pyproj, shapefile, shapely.speedups, centerline.main, shapely.algorithms, shapely.speedups._speedups, shapely.geometry.multipolygon, pyproj.datadir, shapely.geometry.point, fiona.errors, shapely.impl, shapely.geometry.multilinestring, fiona.collection, shapely.geos, shapely.errors, centerline
Traceback (most recent call last):

File "<ipython-input-2-820f256278b1>", line 1, in <module>
runfile('/media/mattes/data1/dataDMattes/Code/Python/PythonProgram/main.py', wdir='/media/mattes/data1/dataDMattes/Code/Python/PythonProgram')

File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

File "/media/mattes/data1/dataDMattes/Code/Python/PythonProgram/main.py", line 42, in <module>
import matlab.engine

File "/home/mattes/.local/lib/python3.5/site-packages/matlab/engine/__init__.py", line 62, in <module>
'MathWorks Technical Support for assistance: %s' % e)

OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/MATLAB/R2018a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libmwengine_api.so)

我还尝试重新安装Matlab引擎,并使用以下命令代替来自Mathworks(python setup.py install)的建议命令:

^{pr2}$

我使用python3.5.2,并在ubuntu16.04中安装了matlabr2018a。在

有人有主意吗?在

非常感谢你的帮助!在


Tags: inpylinecodemediaenginefilemattes
1条回答
网友
1楼 · 发布于 2024-09-27 09:27:37

GLIBCXX_3.4.22' not found

您可以将libstdc++.so.6 -> libstdc++.so.6.0.22解包到$HOME中,并在运行命令时将其包括在内:Example→

export LD_LIBRARY_PATH=/home/[name]/libstdc++6_6.3.0_amd64:$LD_LIBRARY_PATH && import matlab.engine

what is ... [command]

[command]表示要与$HOME中的libstdc++.so.6一起使用的“任何命令”。在

关于文件夹libstdc++6_6.3.0_amd64/:您可以重命名为lib64以获得较短的文件名:/home/[name]/lib64/→

^{pr2}$

相关问题 更多 >

    热门问题