2

OS: Mac OS X 10.11.1 (El Capitan) Python: Homebrew Python 2.7.10 pip: 7.1.2 (latest)

I installed virtualenv by pip install virtualenv, the installation was successful. But when I typed virtualenv, the bash prompted command not found.

I looked into the path /usr/local/lib/python2.7/site-packages and /usr/local/bin but found no executable virtualenv.

How to install and run virtualenv correctly in El Capitan?

3

I have the exact same setup, and when I pip install virtualenv, the executable symlink is added to /usr/local/bin as expected. So it seems like the install your install is not actually successful.

Did you try using to find or locate to search for virtualenv? Try sudo find / -name virtualenv 2>/dev/null.

Since you're a Python developer, you can load up your favorite debugger or editor (I like Spyder, pudb, PyCharm, and Sublime Text) and debug pip itself. Set a breakpoint (or print statements, whichever) at pip/req/req_install.py:L795. Not far from there it will complete the install by moving the appropriate files.

2
  • 1
    I reinstall virtualenv and it worked. I guess it is due to the network issue. – Zelong Nov 23 '15 at 3:25
  • I uninstalled & reinstalled virtualenv several times, and it did not work. Then suddenly, I tried it one more time, and now it works and is installed to /usr/local/bin/virtualenv. ??? – user5359531 Aug 16 '16 at 18:07
1

I guess it installed into /Library/Python/2.7/site-packages. Some python packages tend to install into this directory under El Capitan. You should therefore find a way to install into the correct directory.

1

I had this same problem on Mac OS X El Capitan.

When I installed virtualenv like that sudo pip3 install virtualenv I didn't have virtualenv under my command line.

I solved this problem when I switched to super user account by calling sudo su and then installed virtualenv like that pip3 install virtualenv. Finally I could access virtualenv from both user and super user account. Remember to uninstall previous installations before you switch to super user account.

0

Try to update pip then reinstall virtualenv! That work for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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