1

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.

Malek B.
  • 1,104
  • 1
  • 12
  • 14

2 Answers2

1

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.

peter
  • 41,770
  • 5
  • 64
  • 108
  • Thank you so much for your answer, actually I completely forget to add the path to the system section. – Malek B. Apr 18 '16 at 08:43
  • It's something the python installer should take care of, at least in a MS Windows philosophy. You are welcome – peter Apr 18 '16 at 09:56
0

The SETX command will set the variable permanently. Use SETX /? for information. Set a persistent environment variable from cmd.exe

For Python, many developers use venv which is included with the Python install. https://docs.python.org/3/library/venv.html?highlight=venv#module-venv

Community
  • 1
  • 1
lit
  • 14,456
  • 10
  • 65
  • 119