Python 3 on Mac
July 16, 2017
I'm starting to upgrade an existing Django application form python2 to python3, and also moving to develop on a mac rather than linux.
Virtual Env
In order to create a virtualenv with python 3 (and 2) in it, use the following command:
$ virtualenv -p python3 env_name
You can then install libraries as normal using
$ pip install Django
And once you've installed libraries you can freeze their versions into a _requirements.txt
file using the following command:
$ pip freeze > requirements.txt
You can then run this file elsewhere using
$ pip install -r requirements.txt
Postgis
To install the postgres support for GeoDjango, we must use homebrew to install the following packages
$ brew install postgis $ brew install gdal $ brew install libgeoip