Installing Python 3.6 on MacOS Mojave for QGIS - python

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.

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:
Prerequisites
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
Python installation
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.
QGIS install
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.

Related

Multiple versions of Python installed in different locations - How do I set Python 3.10 as my current version?

I am brand new to programming and installed Python 3.10 from the website (not via terminal). When I began to run code, my computer ran python 2.7 by default. In order to fix this, I installed Python with Brew which updated my default Python version to 3.9.13. However, when I now install libraries like Requests (pip3 install requests), they are installed in the Python 3.10 version I originally downloaded.
Here's where my libraries go:
requests in /usr/local/lib/python3.10/site-packages
My current version:
python --version Python 3.9.13
I am not sure if it is best to set default version to 3.10 or to some how install libraries in 3.9.13.
Please advise.

MacOS Catalina comes with Python 3.7.3, need to upgrade

I recently upgraded to macOS Catalina and it seems to come with Python 3.7.3. All of my packages have come from the PIP installed with Python 3.7.3.
I have installed Python 3.7.7 (the newest version available on Homebrew), but it gives an error when linking. It tells me to run brew link python3, and when I do, it says
Linking /usr/local/Cellar/python/3.7.7...
Error: Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
rm '/usr/local/bin/2to3'
To force the link and overwrite all conflicting files:
brew link --overwrite python
To list all files that would be deleted:
brew link --overwrite --dry-run python
Previously, I accidentally uninstalled Python 3.7.3, which many people have recommended against because it is not a good idea to uninstall the macOS bundled Python and may cause issues with the operating system. I had lost all of the packages installed using PIP, and I had to restore my computer using my Time Machine backup to avoid issues with my operating system.
How can I make the newest version of Python (3.7.7) the default, and "transfer" my packages from PIP into the newest version of Python (if that is even required) and fix my Python installation?
A Python installation of 3.7.3 came with Xcode, so all I had to do was delete the app Xcode, and I ran a fresh installation of Python using Brew.
yes you are right. New MacOs built in python3.7.3 in system and it comes from xcode, u dont't have to uninstall xcode
all you need to do is remove /lib/commandlinetools/freamwork/python3.7.3.
and install newest python with brew.
run python3 --version and pip3 --version they all newest from brew

How to upgrade python version on Ubuntu

I'm using Ubuntu 14.0.4. In my system I have installed Anaconda with python 2.7.14. Now I want to upgrade my python version & would like to use Python 3.6.3. So I followed the steps mentioned in below link
Update python on linux 2.7 to 3.5
But after doing this my python --version command is showing python 2.7.14. Can you suggest me how to upgrade?
It's a little bit tricky with Anaconda.
You need to do this within your Anaconda environment:
conda install python=3.6.3

Install Python 3.5 on Mac for IntelliJ IDEA / PyCharm

I'm using a third-party Python package that supports Python 3.5, but not 3.6. I've got Python 2.7 installed from my OS vendor (it's a Mac), and Python 3.6 installed through homebrew.
What's the best way for me to install 3.5 and configure IntelliJ IDEA (using its Python plugin, so it's basically equivalent to PyCharm) to use it?
You can install as many Python distributions as you want and they all located in /Library/Frameworks/Python.framework/Versions. However, pip3 will only be linked to the last python distribution you installed, not the latest. For example, in my case, my pip3 is the module in python3.5 because I installed it after 3.6. If you want to use a package for a specific version, run $ python3.x -m package. python3.6 -m pip install, for example.

python binary version doesnt match rpm version

I have installed manually python (2.7.3). Whoc do I update the rpm version
usr/bin/python -V:
Python 2.7.3
rpm -qf /usr/bin/python:
python-2.6.5-3.el6.x86_64
any suggestions?
linux version: RH6.3
You installed it incorrectly. Instead of make install you should run make altinstall. This will install the new version of Python parallel to existing versions, and create a new executable in $PREFIX/bin with the name of python followed by the minor version of Python installed, e.g. python2.7.
Create a symlink in /usr/bin/ called python2.7, point to to where you have installed the new Python and use that.
Do not attempt to upgrade or force the default python on a redhat box, because a lot of other tools will stop working.

Categories