0

I was trying to add python path to the system evironment path by python.

I've tried

os.eviron['Path'] += ';C:/Anaconda3/'

However, I found this only make a difference in the script. I checked the system and didn't find ;C:/Anaconda3/ in the environment variable 'Path', which makes command python xxx.py can not be recognized by the system.

Is there any function or method to edit the system evironment path by python?

GGONAK
  • 3
  • 3

1 Answers1

0

Could it be the spelling from environ to eviron?

or...

Maybe a quick batch script could help you do the trick as advised here. In the same question, you can find a way to do in python which would not survive a reboot here, but could do the trick.

  • Oops, I misspelled it. I've tried this but it just work inside the script. Maybe I'd better call py script using the full path of python.exe. – GGONAK Dec 09 '19 at 02:12