Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 is the directory containing the python executable. However, when I type

which python

I get


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

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
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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .