I found a solution to the problem here , so all loans belong to the author.
The bottom line is that when you create virtualenv, many symbolic links are created on Homebrew installed by Python.
Here is one example:
$ ls -la ~/.virtualenvs/my-virtual-env ... lrwxr-xr-x 1 ryan staff 78 Jun 25 13:21 .Python -> /usr/local/Cellar/python/2.7.7/Frameworks/Python.framework/Versions/2.7/Python ...
When you upgrade Python using Homebrew and then run brew cleanup , the symlinks in virtualenv point to paths that no longer exist (since Homebrew deleted them).
Symbolic links should point to newly installed Python:
lrwxr-xr-x 1 ryan staff 78 Jun 25 13:21 .Python -> /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/Python
The solution is to delete the symlinks in virtualenv and then recreate them:
find ~/.virtualenvs/my-virtual-env/ -type l -delete virtualenv ~/.virtualenvs/my-virtual-env
It is probably best to check which links will be removed before deleting them:
find ~/.virtualenvs/my-virtual-env/ -type l
In my opinion, itβs even better to remove only broken symbolic links. You can do this with GNU find :
gfind ~/.virtualenvs/my-virtual-env/ -type l -xtype l -delete
You can install GNU find using Homebrew if you do not already have it:
brew install findutils
Note that by default, GNU programs installed with Homebrew are prefixed with the letter g . This is to avoid obscuring the find binary that comes with OS X.
Ryan Kaskel Sep 20 '14 at 9:31 2014-09-20 09:31
source share