我需要从Matlab中运行一个Python脚本。这个Python脚本会加载matplotlib,但似乎存在问题。错误信息如下:
细节如下:
- 平台 - Linux
- 当我从终端执行Python脚本时,它能够正常运行。
- 当我从Matlab中执行另一个不使用matplotlib的Python脚本时,没有出现问题。
在Mac上,我的其中一位朋友通过修改命令成功地从Matlab中运行了该脚本,命令如下:
syscmd = sprintf('export DYLD_LIBRARY_PATH=""; python sim/loglike.py %s %s', 'sim/queryIn_0515-161222', 'sim/temp.txt'), system(syscmd)
请指点我如何解决这个问题。我在Google上找不到答案。
谢谢!
>> syscmd = sprintf('python sim/loglike.py %s %s', 'sim/queryIn_0515-161222', 'sim/temp.txt'), system(syscmd)
syscmd =
python sim/loglike.py sim/queryIn_0515-161222 sim/temp.txt
Traceback (most recent call last):
File "sim/loglike.py", line 6, in <module>
import matplotlib.pyplot as plt
File "/opt/python27/lib/python2.7/site-packages/matplotlib/pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "/opt/python27/lib/python2.7/site-packages/matplotlib/figure.py", line 34, in <module>
import matplotlib.colorbar as cbar
File "/opt/python27/lib/python2.7/site-packages/matplotlib/colorbar.py", line 29, in <module>
import matplotlib.collections as collections
File "/opt/python27/lib/python2.7/site-packages/matplotlib/collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "/opt/python27/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 37, in <module>
import matplotlib.widgets as widgets
File "/opt/python27/lib/python2.7/site-packages/matplotlib/widgets.py", line 17, in <module>
from lines import Line2D
File "/opt/python27/lib/python2.7/site-packages/matplotlib/lines.py", line 25, in <module>
from matplotlib.font_manager import FontProperties
File "/opt/python27/lib/python2.7/site-packages/matplotlib/font_manager.py", line 53, in <module>
from matplotlib import ft2font
ImportError: /opt/matlab/7.13/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/python27/lib/python2.7/site-packages/matplotlib/ft2font.so)
ans =
1
printenv
命令。也许你可以找到正确的变量来恢复你的朋友所做的相同方式,否则请将信息添加到你的问题中。 - Daniel