I'm trying to install QGIS 3.4.1 on Mac OS Mojave. QGIS install comes as a pkg file, specifically requires python 3.6 (will not work with 3.7), Mac ships with 2.7, and homebrew installs python3 with 3.7.1.
To the Python devs out there - what's the best way of installing Python 3.6 and then QGIS here? Pyenv, venv, pipenv, virtualenv? How would QGIS always find python 3.6 - during install and later when I run it?
What I want to accomplish is run QGIS on python 3.6 and not have python 3.6 change either default Mac 2.7 python, or homebrew python3.
On MacOS, the recommended way to get Python 3. x on your machine is to use the HomeBrew utility. HomeBrew is a package manager similar to the PowerShell Gallery that allows users to download and install programs from a public repository.
QGIS has its version of python installed to handle all the required modules to run the software. So if you need to use the QGIS library from the python console/jupyter notebook, you need to make sure your python can find the QGIS library paths. Or you can install the QGIS library in your python environment.
As stated in QGIS documentation:
The current QGIS package uses the python.org Python 3.6, at least version 3.6.5, the “macosx10.9” build - other distributions are not supported.
So you can install Python 3.6 downloaded from python.org website. Please follow these simple steps:
Please verify the Xcode developer tools are installed:
xcode-select -p
should return
/Library/Developer/CommandLineTools
if not, please run this command
xcode-select --install
Go to https://www.python.org/downloads/mac-osx/ and download the Python 3.6 macOS 64 bit installer (currently 3.6.7). This is a pkg
installer you can run like many other software. If you don't want to replace the Python 3.7 you installed from brew, ensure this Python distribution is NOT added to the system $PATH. By default, it will install under /Library/Frameworks/Python.framework/Versions/3.6
.
Now you have the correct Python installed, download QGIS package.
Install the pkg in the right order
Run QGIS and open "Preferences". Go to System > Environment.
Check "Use custom variables" and click green "plus" sign. Under "Apply", select "Prepend", set PATH
as variable and paste
/Library/Frameworks/Python.framework/Versions/3.6/bin:
as Value. This will help QGIS locating the correct python interpreter. Click OK, restart QGIS and you should be done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With