How to solve a bug when you use python virtual environment (venv) and pip develop installation together

The Bug

When you use python -m pip install -e ., you get a permission error.

The Reason 

python virtual environment or venv is weak, it doesn’t have that much permission. (It’s a good thing since the apps inside of virtual environment normally don’t require root permissions. And by doing so, we could avoid potential computer virus)

If you previously have used sudo to install a package, some files under your project may get affected. In that case, if you are trying to install your package with virtual environment, things got wrong.

The Solution

Change the permission back by using:

user=$(whoami)
sudo chown -R $user:$user .