### Installing global Python & Pip
Use Brew
brew install python
That'll install both Python, PIP and setuptools. If for some reason it didn't install PIP you can do via
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
sudo python get-pip.py
(Side note that you should install multiple versions of Python via Pyenv rather than Brew to avoid any bad Python conflicts)
pip install virtualenv virtualenvwrapper
You'll need to tell ZSH where virtualenvs need to be put
In ~/.zshrc add
# Virtualenvwrapper things
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
By default the ZSH virtualenv plugin hides the virtualenv name. I've no idea why...
nano ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh
Within that file you'll see
# disables prompt mangling in virtual_env/bin/activate
export VIRTUAL_ENV_DISABLE_PROMPT=1
Hash out export VIRTUAL_ENV_DISABLE_PROMPT=1
and reload ZSH.
Test that all working by doing something like
~ mkvirtualenv test2
You should see
New python executable in /Users/edd/.virtualenvs/test2/bin/python2.7
Also creating executable in /Users/edd/.virtualenvs/test2/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/edd/.virtualenvs/test2/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/edd/.virtualenvs/test2/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/edd/.virtualenvs/test2/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/edd/.virtualenvs/test2/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/edd/.virtualenvs/test2/bin/get_env_details
(test2) ➜ ~ pip install something_awesome_inside_my_obvious_virtualenv
You got error message while installing OPENCV
pi@:/ $ source ~/.profile
/usr/bin/python2.7: 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/python2.7 and that PATH is
set properly.
It ll solve ur problem..
Procedure is
$ sudo pip3 install virtualenvwrapper
pi@:/ $ ls /usr/bin/python*
/usr/bin/python /usr/bin/python3 /usr/bin/python3-config
/usr/bin/python2 /usr/bin/python3.5 /usr/bin/python3m
/usr/bin/python2.7 /usr/bin/python3.5-config /usr/bin/python3m-config
/usr/bin/python2.7-config /usr/bin/python3.5m /usr/bin/python-config
/usr/bin/python2-config /usr/bin/python3.5m-config
pi@:~ $ cd /usr/local/bin
pi@:/usr/local/bin $ ls
dronekit-sitl mavgpslock.py mavsummarize.py
futurize mavgpslock.pyc mavsummarize.pyc
magfit_delta.py mavgraph.py mavtogpx.py
magfit_delta.pyc mavgraph.pyc mavtogpx.pyc
magfit_gps.py mavkml.py mavtomfile.py
magfit_gps.pyc mavkml.pyc mavtomfile.pyc
magfit_motors.py mavlogdump.py mp_slipmap.py
magfit_motors.pyc mavlogdump.pyc mp_slipmap.pyc
magfit.py mavloss.py mp_tile.py
magfit.pyc mavloss.pyc mp_tile.pyc
MAVExplorer.py mavmission.py MPU6KSearch.py
MAVExplorer.pyc mavmission.pyc MPU6KSearch.pyc
mavextract.py mavparmdiff.py pasteurize
mavextract.pyc mavparmdiff.pyc pbr
mavfft.py mavparms.py pip
mavfft.pyc mavparms.pyc pip2
mavflightmodes.py mavplayback.py pip2.7
mavflightmodes.pyc mavplayback.pyc pip3
mavflighttime.py mavproxy.py pip3.5
mavflighttime.pyc mavproxy.pyc virtualenv
mavflightview.py mavsearch.py virtualenv-clone
mavflightview.pyc mavsearch.pyc virtualenvwrapper_lazy.sh
mavgen.py mavsigloss.py virtualenvwrapper.sh
mavgen.pyc mavsigloss.pyc
pi@:/ $ nano ~/.profile
Add the following line at the end of the line
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
pi@:/ $ source ~/.profile
Its Working..
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/premkproject
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/postmkproject
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/initialize
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/premkvirtualenv
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/postmkvirtualenv
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/prermvirtualenv
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/postrmvirtualenv
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/predeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/postdeactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/preactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/postactivate
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/get_env_details
pi@:/ $