Question: I recently installed a bunch of dotfiles on my Mac along with some other applications (I changed to iTerm instead of Terminal, and Sublime as my default text editor) but ever since, all my virtual environments have stopped working, although their folders inside .virtualenvs are still there and they give the following error whenever I try to run anything in them:

```
dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/[user]/.virtualenvs/modclass/bin/python
  Reason: image not found
Trace/BPT trap: 5

```

I have removed all the files related to dotfiles and have restored my .bash\_profile to what it was before, but the problem persists. Is there any way to diagnose the problem or solve it in an easy way (e.g. not requiring to create all the virtualenvs all over again)?

Answer: 
[It appears](https://github.com/Homebrew/homebrew/issues/29247) the proper way to resolve this issue is to run

```
 pip install --upgrade virtualenv

```

after you have upgraded python with Homebrew. 

This should be a general procedure for any formula that installs something like python, which has it's own package management system. When you install `brew install python`, you install `python` and `pip` and `easy_install` and `virtualenv` and so on. So, if those tools can be self-updated, it's best to try to do so before looking to Homebrew as the source of problems.
I was facing the same issue after upgrading brew on my OSX Catalina.

After trying bunch of stuffs, I find the following is the best and easy solution.

At first, delete the virtual env. (Optional)

```
find myvirtualenv -type l -delete

```

then recreate a new virtualenv

```
virtualenv myvirtualenv

```

Reference: <https://www.jeremycade.com/python/osx/homebrew/2015/03/02/fixing-virtualenv-after-a-python-upgrade/>