Reputation: 19172
I'm struggling pretty hard to find a tutorial that's still relevant. Is virtualenvwrapper
no longer relevant on Mac (OS 11.4) as of 2021?
I get this on opening my zsh
:
/Library/Developer/CommandLineTools/usr/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.
➜ ~ echo $VIRTUALENVWRAPPER_PYTHON
/usr/bin/python3
➜ ~ which virtualenv
/usr/local/bin/virtualenv
➜ ~ which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh
where my ~/.zshrc
contains:
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/sbin:$PATH"
# For virtualenvwrapper
export PATH=/usr/local/share/python:$PATH
export WORKON_HOME=${HOME}/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
#export VIRTUALENVWRAPPER_VIRTUALENV=${HOME}/.local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source $(which virtualenvwrapper.sh)
I no longer have python3 installed from the Mac installer downloaded from https://www.python.org/downloads/.
I appear to have no less than three installations of python3:
/usr/bin/python3
/usr/local/bin/python3
/Library/Developer/CommandLineTools/usr/bin/python3
and my latest attempt at installing python3 with brew
fails at pygobject
:
➜ ~ brew reinstall pygobject
==> Downloading https://download.gnome.org/sources/pygobject/2.28/pygobject-2.28.7.tar.xz
Already downloaded: /Users/stellios/Library/Caches/Homebrew/downloads/229c52d9a07d25ee8cea203c1a0a6d567c422a034c9ff0a686a9f84e0fa0fd68--pygobject-2.28.7.tar.xz
==> Reinstalling pygobject
Error: An exception occurred within a child process:
FormulaUnavailableError: No available formula with the name "/usr/local/opt/pygobject/.brew/pygobject.rb".
Upvotes: 1
Views: 2324
Reputation: 19172
I'm still at a loss as why all the python3 version and places, but standardizing on /usr/local/bin
seems to resolve my issues.
# For virtualenvwrapper
export PATH=/usr/local/bin:$PATH
export WORKON_HOME=${HOME}/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
Upvotes: 1