Search code examples
cmdwindows-7-x64environmentsetting

Setting environment changes?


I would like to ask you if it's normal that my "Setting environment" changes after each system reboot or even if I just close my cmd console.

for example, I'm using python 3.5, when I wan to use python or to uses pip under the cmd I got an error like :

C:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.

To fix this, I use :

set PATH=%PATH%;C:\Python35

It works after, but as I said before, once I restart my computer, or I close the console, I've the same problem !!!

Thanks in advance for your help and comments. I just would like to inform you that I'm using Windows 7 - 64bits.


Solution

  • You need to add this path in System (Windows+Pause key), Advanced, Environment variables. There you have two sections, System and User, in System, edit the PATH key. The next time you start a console the path will be present.

    Alternaly, if you don't want to modify the setting there (or you have no rights) you could start the app with a batch file which sets the path before launching the app.

    In Ruby you can adapt the environment variables from within the script itself by using ENV eg ENV['path'] += 'C:\\Python35' , I'm sure Python can do this too but wouldn't know how. In your use case this won't help of course.