seenaomi.net – blog

Learning in motion

Installing virtualenvwrapper with python3 on macOS

without comments

I started to tweet about this but then the explanation was too large for a tweet. I also read that someone stated that if it’s too long for a simple tweet then blog about it…

I’m a Django fullstack developer currently and do so on a linux desktop at work. I honestly haven’t done much developing at home in almost a year and my mac’s setup is in need of some maintenance.

So doing something once can make the pain points memorable but fuzzy when you try to do it again a year later. That’s what occurred this evening while installing virtualenvwrapper. It’s handy once configured correctly and installed. So here’s some help.

I started with this refresher

Which is a nice start of course except for the fact that my virtualenvwrapper.sh file was not where it was “supposed to be”.

The pip tells you where it’s installing everything.

For me it was here:

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages

Then I moved on to this tutorial

Which was helpful in troubleshooting with the reference of the /.bash_profile but really that’s all it helped me with.

More looking at directories, more trying different tutorials etc… then I run into this stackoverflow question that was my eureka!

export WORKON_HOME=$HOME/code/.virtualenvs
export PROJECT_HOME
=$HOME/code
export VIRTUALENVWRAPPER_PYTHON
=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV
=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS
='--no-site-packages'

source /usr/local/bin/virtualenvwrapper.sh

Save, close.

then:  $ source ~/.bash_profile

and: $ mkvirtualenv test

Except I had to change the above up a little bit to match what I had going on.  First I needed to confirm the location of my virtualenvwrapper.sh file.

Which I did with:  sudo find /Library -name virtualenvwrapper.sh

RESULT: /Library/Frameworks/Python.framework/Versions/3.5/bin/virtualenvwrapper.sh

Then I noted that my python directory is actually a python3 directory so I threw a 3 at the end.

Ultimately I added the below to my .bash_profile file:

export WORKON_HOME=$HOME/code/.virtualenvs
export PROJECT_HOME=$HOME/code
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/Library/Frameworks/Python.framework/Versions/3.5/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=’–no-site-packages’

source /Library/Frameworks/Python.framework/Versions/3.5/bin/virtualenvwrapper.sh

Saved and closed the file.

Went back to my terminal..

naomisee at Naomis-MacBook-Pro-8 in ~/repos on master [+!?]

$ source ~/.bash_profile

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/premkproject

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/postmkproject

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/initialize

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/premkvirtualenv

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/postmkvirtualenv

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/prermvirtualenv

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/postrmvirtualenv

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/predeactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/postdeactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/preactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/postactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/virtualenvs/get_env_details

 

naomisee at Naomis-MacBook-Pro-8 in ~/repos on master [+!?]

$ mkvirtualenv opug

Using base prefix ‘/Library/Frameworks/Python.framework/Versions/3.5’

New python executable in /Users/naomisee/code/.virtualenvs/opug/bin/python3.5

Also creating executable in /Users/naomisee/code/.virtualenvs/opug/bin/python

Installing setuptools, pip, wheel…done.

virtualenvwrapper.user_scripts creating /Users/naomisee/code/.virtualenvs/opug/bin/predeactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/code/.virtualenvs/opug/bin/postdeactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/code/.virtualenvs/opug/bin/preactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/code/.virtualenvs/opug/bin/postactivate

virtualenvwrapper.user_scripts creating /Users/naomisee/code/.virtualenvs/opug/bin/get_env_details

(opug) naomisee at Naomis-MacBook-Pro-8 in ~/repos on master [+!?]

$ deactivate

naomisee at Naomis-MacBook-Pro-8 in ~/repos on master [+!?]

So that is that! I’m super happy that I took the time to jot this down because a year from now I’ll probably have to do it again.

 

Written by seenaomi

November 15th, 2017 at 1:23 am

Posted in Allthecode

Leave a Reply