Running python code from Matlab program on Ubuntu
11 次查看(过去 30 天)
显示 更早的评论
I try to use system(my_trigger_str) function in matlab in order to run my python program on Ubuntu (16.04).
While when I run my_trigger_str from the terminal it runs well, when I run it using system() in matlab it does not succeed import any package I use in my python code. For example, I import matplotlib in line 3 in my python program, and I receive this error. It happens for any package I try to import. From the terminal in runs well.
Any idea?
Traceback (most recent call last):
File "/home/kent/Desktop/SegUtilities/eval_model_PR.py", line 3, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 36, in <module>
from matplotlib.figure import Figure, figaspect
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 35, in <module>
from matplotlib import _image
ImportError: /usr/local/MATLAB/R2017a/sys/os/glnxa64/libstdc++.so.6: version
`GLIBCXX_3.4.21' not found (required by /usr/lib/python3/dist-packages/matplotlib/_image.cpython-35m-x86_64-linux-gnu.so)
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/local/MATLAB/R2017a/sys/os/glnxa64/libstdc++.so.6: version
`GLIBCXX_3.4.21' not found (required by /usr/lib/python3/dist-packages/apt_pkg.cpython-35m-x86_64-linux-gnu.so)
Original exception was:
Traceback (most recent call last):
File "/home/kent/Desktop/SegUtilities/eval_model_PR.py", line 3, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 36, in <module>
from matplotlib.figure import Figure, figaspect
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 35, in <module>
from matplotlib import _image
ImportError: /usr/local/MATLAB/R2017a/sys/os/glnxa64/libstdc++.so.6: version
`GLIBCXX_3.4.21' not found (required by /usr/lib/python3/dist-packages/matplotlib/_image.cpython-35m-x86_64-linux-gnu.so)
22 inputParts = regexp(inputArray, ';', 'split');
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!