Previous | Next


Let’s add the Python directory into the PATH environment variable so that the operating system will search through when programs attempt to execute a command

Adding directory to Windows PATH environment variable

Run the Windows command prompt and type the following:

C:\>PATH %path%;C:\python

This will add C:\python into windows PATH environment variable. Please note that, the Python directory in your machine might use a different name, so please make sure you enter the correct directory name.

 

Adding directory to Linux PATH environment variable

The Python directory used to be added into the Linux environment variable during the installation. In case it’s not, check where the Python bin is located in you Linux box. It used to be located either in

  • /usr/local/bin/ or
  • /usr/bin/

Once you identify where it located, then run the following command in the linux terminal:

export PATH="$PATH:/usr/local/bin/python"

or

export PATH="$PATH:/usr/bin/python"

 

Adding directory to Mac OS X PATH environment variable

The Python directory used to be added into the Mac OS X environment variable during the installation. In case it’s not, following the step to add directory to your Mac OS X PATH variable

  1. Open the Terminal application. It can be found in the Utilities directory inside the Applications directory.
  2. Type the following: echo ‘export PATH=YOURPATHHERE:$PATH’ >> ~/.profile, replacing “YOURPATHHERE” with the name of the directory you want to add. Make certain that you use “>>” instead of one “>
  3. Hit Enter.
  4. Close the Terminal and reopen. Your new Terminal session should now use the new PATH.

Previous | Next