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'm sorry if this question is asked in a different way before. I did my due search effort on Google and StackOverFlow(SOF), but the search terms that I tried haven't returned the answer I was looking for.

The problem is: I have installed Python virtualenv locally (that is, in "~/.local/") because I don't have sudo access to my school machine. The virtualenv now sits in "~/Download/modules/virtualenv-1.9.1/" and when I try to use it, I always have to type in something like:

$ python ~/Download/modules/virtualenv-1.9.1/ --distribute venv

I would like to do something like

$ virtualenv --distribute venv

I know I can add "alias" in "~/.cshrc" (or bash equivalent), but I'm wondering if there is alternative way to do this rather than adding more aliases. Sincere apology if this is a repeated (and naive/beginner) question. As I mentioned before, I wasn't successful in coming up with correct search terms to figure out the solution on Google/SOF. Thank you for your help.

share|improve this question

migrated from Jun 7 '13 at 4:43

This question came from our site for professional and enthusiast programmers.

Sure, you can set a local variable. Try this out:

export MY_CUSTOM_VAR=/Users/YOURUSERNAMEHERE/Download/modules/virtualenv-1.9.1

Then you should be able to use $MY_CUSTOM_VAR in place of that directory in any command.

share|improve this answer

I would probably put a script in ~/bin/venv

exec python \
    ~/Download/modules/virtualenv-1.9.1/ \
    --distribute venv \

(make that executable with chmod u+x ~/bin/venv).

Don't forget to put ~/bin in your $PATH.

share|improve this answer

You must log in to answer this question.