1

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?

3

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

You must log in to answer this question.

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