5
votes

I am new to python and trying to install it on my centos server . By default there was 2.6 version which I deleted and installed the new version 2.7.x ...

But I am facing problem . when I type the below command it gives me the message

python --version
-bash: python: command not found

I can see that python is installed in /usr/local/bin .. How can I set the path so I may run the above command and it gives me the correct version..

Please help

1
Note that removing the installed Python can cause all sorts of problems for system stuff that expects to be able to use that Python. It's generally much safer to install a new Python version separately.PM 2Ring

1 Answers

10
votes

You need to add python to your $PATH environment variable. You can use the following command:

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

This will append the /usr/local/bin/python to the existing $PATH. It is necessary to reopen the shell window afterwards.