I want to add a folder to the Windows PATH environment variable with Python. I tried these three code snippets but none worked:
os.environ['PATH'] += ";C:\my\folder"
and
sys.path.insert(0, os.path.abspath('C:\my\folder'))
and
if sys.platform == 'win32':
sep = ';'
else:
sep = ':'
os.environ['PATH'] += sep + r'"C:\my\folder"'
You should use:
os.environ['PATH'] += R";C:\my\folder"