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.

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

6 Comments

Should I do it on my .bash_profile also? or just doing once will be okay?
You should add it to your .bash_profile. Doing it once will work for your current session only.
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
Sorry for structure of my comment above but although I added it still runs python2.7.2 when I wrote python2.7
remove your aliases. and your python PATH export is wrong. You add /opt/python2.7.1/bin before $PATH
|
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/"

1 Comment

alias is not enough. python has library dependencies as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.