Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed a python interpreter to a user-directory on a system where I do not have root-access. This system has an older version of Python already installed. I want to make my local installation the default for me. So basically, when I type python, instead of /usr/bin/python I want ~/MyPythonDir/python to be invoked.

Thanks in advance

EDIT: I have changed my PATH to look like this right after I log in:

echo $PATH
~/MyPythonDir:OtherPathStuff

MyPythonDir is the directory containing the python executable. However, when I type

which python

I get

/usr/bin/python

Also, MyPythonDir contains python2.7, but when I try to execute that it says it cannot find it.

share|improve this question
    
You should specify what shell you're using. Most people will assume Bash or sh. –  Dennis Williamson Aug 10 '10 at 15:18

2 Answers 2

You may want to look into virtualenv

virtualenv is a tool to create isolated Python environments.

share|improve this answer
up vote 0 down vote accepted

Ok, I found the problem. In the setup-script (.tcshrc) I set the path using the tilde. When I replaced the tilde by the full path, it worked! Can anyone explain this?

share|improve this answer
    
can you show the exact line you used in .tcshrc? –  matthias krull Aug 10 '10 at 14:57
2  
The tilde is really only an interactive command line convenience. There are lots of places it won't get expanded. Use $HOME instead. –  Dennis Williamson Aug 10 '10 at 15:16
1  
in scripts it usually does but it gets escaped by "" so echo "$HOME" and echo ~ will expand but echo "~" will not. –  matthias krull Aug 10 '10 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.