0

This is the output when I write whereis python2.7

python2.7: /usr/local/bin/python2.7 /usr/local/lib/python2.7 /opt/python2.7.1/bin/python2.7

Version of python under /usr/local/ is python2.7.2 and version of python under /opt/python/2.7.1 is python2.7.1 as you see.

When I write python it runs python2.7.1 because I changed the bash_profile. But When I write python2.7 it runs python2.7.2.

I would like totally remove the python2.7.2 which is under the /usr/local/ and use the binary under /opt/python2.7.1.

How can I solve this problem?

Note: It is a CentOS5 server and python2.4 is already installed as you consider.

brsbilgic
  • 11,613
  • 16
  • 64
  • 94

2 Answers2

2

your PATH is mixed up, do the following:

export PATH=/opt/python2.7.1/bin:$PATH
export LD_LIBRARY_PATH=/opt/python2.7.1/lib:$LD_LIBRARY_PATH
aayoubi
  • 11,285
  • 3
  • 22
  • 20
  • Should I do it on my .bash_profile also? or just doing once will be okay? – brsbilgic Oct 04 '12 at 08:48
  • You should add it to your .bash_profile. Doing it once will work for your current session only. – aayoubi Oct 04 '12 at 08:56
  • PATH=$PATH:$HOME/bin #export PATH alias python='/opt/python2.7.1/bin/python' alias python2.7.='/opt/python2.7.1/bin/python' alias python2.7.1='/opt/python2.7.1/bin/python' export PATH=$PATH:/opt/python2.7.1/bin export LD_LIBRARY_PATH=/opt/python2.7.1/lib:$LD_LIBRARY_PATH – brsbilgic Oct 04 '12 at 08:58
  • Sorry for structure of my comment above but although I added it still runs python2.7.2 when I wrote python2.7 – brsbilgic Oct 04 '12 at 09:00
  • 1
    remove your aliases. and your python `PATH` export is wrong. You add `/opt/python2.7.1/bin` before `$PATH` – aayoubi Oct 04 '12 at 09:01
  • that worked great.Could you look at this question also http://stackoverflow.com/questions/12724050/easy-install-conflict-for-python2-4-and-python2-7 . Thanks a lot! – brsbilgic Oct 04 '12 at 09:18
0

You could simply try using an alias in ~/.bash_aliases so that you always refer to the python you want inside your terminal and user instance. I would not recommend removing python2.7.2 as it might cause dependency issues

Like this

alias python2.7 = "/path/to/python2.7.1/"
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96