I need to run a python script with opencv library in Mathematica. The mathematica command RunProcess[{"python3",ExpandFileName@"~/Documents/8_pyMathematica/pyMM/head_snake/ mm_call_python/show.py "}]
The code of show.py
file : import sys import cv2 src = cv2.imread("test.jpg") cv2.namedWindow("input", cv2.WINDOW_AUTOSIZE) cv2.imshow("input", src) cv2.waitKey(0) cv2.destroyAllWindows()
test.jpg is shown as follow.
When I run the Mathematica command, I get an error <|"ExitCode" -> 1, "StandardOutput" -> "", "StandardError" -> "Traceback (most recent call last): File \"/home/zhou/Documents/8_pyMathematica/pyMM/head_snake/mm_call_python/show.py\", line 13, in <module> import cv2 ImportError: /usr/lib/x86_64-linux-gnu/libatspi.so.0: undefined symbol: g_type_class_adjust_private_offset "|>
I refer to the question: https://mathematica.stackexchange.com/q/115069/72466. I try to use RunProcess[{"LD_LIBRARY_PATH=python3",ExpandFileName@"~/Documents/8_pyMathematica /pyMM/head_snake/mm_call_python/show.py "}]
It returns a error RunProcess: Program LD_LIBRARY_PATH=python3 not found. Check Environment["PATH"].
The command is ran on Ubuntu 16.04. What is the general method to handle this kind of issues and how to fix this problem?