Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the python path in Centos Linux

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

like image 853
ssnegi Avatar asked Feb 01 '16 12:02

ssnegi


People also ask

Where is Python path on CentOS?

Setting path at Unix/Linux In the csh shell − type setenv PATH "$PATH:/usr/local/bin/python" and press Enter. In the bash shell (Linux) − type export PATH="$PATH:/usr/local/bin/python" and press Enter. In the sh or ksh shell − type PATH="$PATH:/usr/local/bin/python" and press Enter.

Where is Python path set in Linux?

Setting Path in Unix or Linux In the csh shell, type the following sentence: PATH “$PATH:/usr/local/bin/python” and press Enter. If you are using the standard flavour of Linux, open up the bash shell and type the following phrase, export PATH=”$PATH:/usr/local/bin/python” and press Enter.


1 Answers

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.

like image 195
Dropout Avatar answered Sep 28 '22 16:09

Dropout