I recently ran (OS X 10.6.8) brew update
and brew upgrade
and am working in a virtualenv that now fails. I've tried:
$ brew unlink python && brew link python
Unlinking /usr/local/Cellar/python/2.7.8_1... 38 symlinks removed
Linking /usr/local/Cellar/python/2.7.8_1... 35 symlinks created
But in the virtualenv, I still get this:
$ python --version
dyld: Library not loaded: @executable_path/../.Python
Referenced from: /Users/admin/.virtualenvs/saves/bin/python
Reason: image not found
Trace/BPT trap
I've found another post on this, but the solution still seems unclear. I'm in a hurry, so uninstalled the Python version and ran brew doctor
which returned the error above as a warning:
sh: line 1: 40991 Trace/BPT trap python -V 2>&1
Then brew install python
. Still getting the above error in the virtualenv.
Related questions and a post on debugfix aren't definitive:
Broken references in Virtualenvs
dyld-library-loaded-executable_path-python
Creating a new virtualenv solved this specific problem.
Use something like this:
find <virtualenv> -type l -delete
virtualenv -p $(which python3) <virtualenv>
All of the symlinks are broken, so it's necessary to delete them. When you recreate the virtualenv it recreates the symlinks while keeping installed packages.
Note: Replace $(which python3)
with location of whatever python version you want to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With