I'am trying to start an exe file (the exe file is the output of c++ project compiled with visual studio) from a python program. In the properties of this c++ project (configuration ->properties-> debugging-> environment) the following setting in the
(PATH = %PATH%;lib\testfolder1;lib\testfolder2)
is given.
is there any way to set path environment variable to
PATH = %PATH%
lib\testfolder1
lib\testfolder2
in a python program?
Thanks in advance for your replay
解决方案
You can update PATH using several methods:
import sys
sys.path += ["c:\\new\\path"]
print sys.path
or
import os
os.environ["PATH"] += os.pathsep + os.pathsep.join(["c:\\new\\path"])
print os.environ["PATH"]