Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to create a virtualenv but it doesn't find the command.

$ virtualenv venv
-bash: virtualenv: command not found

It is installed:

$ pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Cleaning up...

What could be causing that?

share|improve this question

1 Answer 1

If you want to use a command without typing the path to the executable, you need to put it (or a symbolic link to it) in one of the the directories where the system looks for executable whenever no path to the command is provided, for example /usr/bin and /usr/local/bin.

So in your case I would put a symbolic link to virtualenv in /usr/local/bin:

ln -s /path/to/virtualenv /usr/local/bin/virtualenv
share|improve this answer
    
Thanks for your answer. Sorry I am quite new to all this. What shall I put into /path/to/virtualenv? –  ustroetz Jul 14 '13 at 17:50
    
The path to the virtualenv executable. So since you've used pip to install virtualenv it SHOULD be /usr/local/lib/python2.7/site-packages/virtualenv.py –  cyphorious Jul 14 '13 at 19:43
    
I tried that and it says File exists: $ ln -s /usr/local/lib/python2.7/site-packages/virtualenv.py /usr/local/bin/virtualenv ln: /usr/local/bin/virtualenv: File exists. If I try to make a new virtualenv it still doesn't work: $ virtualenv venv -bash: virtualenv: command not found –  ustroetz Jul 14 '13 at 20:05
1  
try ln -sf .... –  cyphorious Jul 14 '13 at 20:06
1  
You need to run the command under superuser mode. so type sudo in front of the command: sudo ln -sf .... And read a bit about Mac OS X (or Unix/Linux) basics. –  cyphorious Jul 14 '13 at 20:12

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.