mcdado
mcdado

Reputation: 728

Using virtualenv and virtualenvwrapper without homebrew's Python

I use Homebrew to manage most of my software installs, but I find it complicated to use Python, especially virtualenv (and virtualenvwrapper) to manage package in an isolated way. The problem is that I found that virtualenv symlinks python to the current version of Python installed via Homebrew, like this:

~/.pip/virtualenvs/httpie
├── include
│   └── python2.7 -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/include/python2.7
└── lib
    └── python2.7
        ├── UserDict.py -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py
        ├── UserDict.pyc
        ├── _abcoll.py -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py
        ├── _abcoll.pyc
        ├── _weakrefset.py -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_weakrefset.py
        ├── _weakrefset.pyc
        ├── abc.py -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.py
        ├── abc.pyc
        ├── codecs.py -> /usr/local/Cellar/python/2.7.7_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py
        ├── codecs.pyc
[...]

This causes all sorts of problems of linkage whenever there's an update to Python via homebrew:

$ http --head http://flic.kr/p/dQm85A
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/3dweb/.pip/virtualenvs/httpie/bin/python2.7
  Reason: image not found
Trace/BPT trap: 5

How can I setup virtualenv to ALWAYS (automatically) point to the system Python whenever i create a new virtualenv?

Upvotes: 0

Views: 462

Answers (1)

Sean Perry
Sean Perry

Reputation: 3886

Install virtualenv into the system Python via pip outside of homebrew. Invoke that virtualenv directly.

Upvotes: 1

Related Questions