For example, if I have a Python script called simple.py that contains code as simple as
a=1
print(a)
then
RunProcess[{"python", "E:\\w\\simple.py"}]
is OK and gives
<|"ExitCode" -> 0, "StandardOutput" -> "1
", "StandardError" -> ""|>
However, if I edit simple.py as
import numpy as np
a=np.array([1,2])
print(a)
then
RunProcess[{"python", "E:\\w\\simple.py"}]
gives
<|"ExitCode" -> 1, "StandardOutput" -> "",
"StandardError" -> "Traceback (most recent call last):
File \"E:\\w\\WORK\\python\\learning\\simple.py\", line 1, in \
<module>
import numpy as np
File \"D:\\IntelPython35\\lib\\site-packages\\numpy\\__init__.py\"\
, line 158, in <module>
from . import add_newdocs
File \"D:\\IntelPython35\\lib\\site-packages\\numpy\\add_newdocs.\
py\", line 13, in <module>
from numpy.lib import add_newdoc
File \"D:\\IntelPython35\\lib\\site-packages\\numpy\\lib\\__init__\
.py\", line 8, in <module>
from .type_check import *
File \"D:\\IntelPython35\\lib\\site-packages\\numpy\\lib\\type_\
check.py\", line 11, in <module>
import numpy.core.numeric as _nx
File \"D:\\IntelPython35\\lib\\site-packages\\numpy\\core\\__init_\
_.py\", line 21, in <module>
from . import umath
ImportError: DLL load failed: ÕÒ\.b2»\[Micro]½Ö¸\[Paragraph]¨\
\[Micro]Ä\.b3ÌÐò¡£
"|>
What is wrong? How can I make NumPy work with RunProcess?
Update
I've tried on a Linux computer. The same Python script works. So is it a problem of why RunProcess doesn't import packages correctly on Windows?
Update
A workaround.
I uninstalled Intel Python and install Anaconda.
Now it is working. Maybe Intel Python misses something in the PATH.
Environment["PATH"]
andecho %PATH%
. But they are the same except thatEnvironment["PATH"]
has 6 more path related to Mathematica thanecho %PATH%
. And here is my system path pastebin.com/2Zscj75e $\endgroup$