Running python code from Matlab program on Ubuntu

10 Ansichten (letzte 30 Tage)
Gilad Book
Gilad Book am 26 Apr. 2018
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');

Antworten (0)

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by