Phytonaut Mac OS

Check the new method below for preferred installation! Easyinstall has been deprecated. Please use get-pip.py instead. Step #1 — First of all download the get-pip file by running: curl -o get-pip.py. Step #2 — Now run this file to install pip. Python get-pip.py. That should do it. Mac OS X comes with Python 2.7 out of the box. You do not need to install or configure anything else to use Python 2. These instructions document the installation of Python 3. The version of Python that ships with OS X is great for learning, but it’s not good for development.

  1. Phytonaut Mac Os X
  2. Phytonaut Mac Os Catalina

Install Miniconda Python¶

There is a known issue with version 3.7 of Anaconda Python and certain versions of the Mac OSX operating system. We strongly recommend that you use python 3.6 on OSX to avoid any problems. To install python 3.6, please follow the steps below:

  1. To get started you need to download the OSX miniconda installer.

    1. Click on the link https: https://repo.continuum.io/miniconda/Miniconda3-4.5.4-MacOSX-x86_64.sh to download the Python 3.6 installer.

    2. Wait for it to download. It will place a file called Miniconda3-4.5.4-MacOSX-x86_64.sh in your downloads folder. On my computer using Safari this is ~/Downloads

  2. Open a Terminal window. If you don’t know how to do this click * Applications -> Utilities -> Terminal*

  3. Within the Terminal change directories into the folder where your downloaded file lives, i.e.

  4. Now run the bash “shell” program to install Miniconda

  5. Scroll through the license (press the space bar to move through quickly), type ‘yes’ to approve the terms, and then accept all the installation defaults.

  6. Close the Terminal program. Then, restart it.

  7. Within the Terminal type:

    1. Enter y at the Proceed prompt.

    2. When the installation completes, close the Terminal window.

Install Spyder IDE and Connect It to Miniconda Python¶

The second half of the installation is the Spyder IDE development environment. This is the software that you use to write, edit and test your Python programs. Spyder IDE calls Python to actually run the program. Spyder is included by default in the Anaconda Python distribution, which comes with everything you need to get started in an all-in-one package.

However, with Miniconda, we have to download and install Spyder IDE.

  1. Go to the Terminal window.

  2. Type the following command:

    1. This will take some time to download.

    2. When the following prompt appears:

    3. Type y, and hit enter.

  3. Once the download is finished, type the following command to know the location of Spyder:

    It is usually installed in the bin folder within miniconda3

  4. To start Spyder, go to a terminal window and enter

Detecting 64-bits versus 32-bits Mac OS X Systems¶

You are running 64-bit Mac OS X.

Technically, all Apple computers purchased since Q4 2006 have been equipped with 64-bit capable processors. The Mac OS X operating system has supported 64-bit by default since OS X 10.6 Snow Leopard, released in 2009. The upgrade to the latest operating system for your computer is available for free, directly from Apple, since the release of OS X 10.9 Mavericks in 2013.

Mac OS X comes with Python 2.7 out of the box.

You do not need to install or configure anything else to use Python 2. Theseinstructions document the installation of Python 3.

The version of Python that ships with OS X is great for learning, but it’s notgood for development. The version shipped with OS X may be out of date from theofficial current Python release,which is considered the stable production version.

Doing it Right¶

Let’s install a real version of Python.

Before installing Python, you’ll need to install GCC. GCC can be obtainedby downloading Xcode, the smallerCommand Line Tools (must have anApple account) or the even smaller OSX-GCC-Installerpackage.

Note

If you already have Xcode installed, do not install OSX-GCC-Installer.In combination, the software can cause issues that are difficult todiagnose.

Phytonaut Mac Os X

Note

If you perform a fresh install of Xcode, you will also need to add thecommandline tools by running xcode-select--install on the terminal.

While OS X comes with a large number of Unix utilities, those familiar withLinux systems will notice one key component missing: a package manager.Homebrew fills this void.

To install Homebrew, open Terminal oryour favorite OS X terminal emulator and run

The script will explain what changes it will make and prompt you before theinstallation begins.Once you’ve installed Homebrew, insert the Homebrew directory at the topof your PATH environment variable. You can do this by adding the followingline at the bottom of your ~/.profile file

If you have OS X 10.12 (Sierra) or older use this line instead

Phytonaut

Now, we can install Python 3:

This will take a minute or two.

Pip¶

Homebrew installs pip pointing to the Homebrew’d Python 3 for you.

Working with Python 3¶

At this point, you have the system Python 2.7 available, potentially theHomebrew version of Python 2 installed, and the Homebrewversion of Python 3 as well.

will launch the Homebrew-installed Python 3 interpreter.

Phytonaut Mac Os Catalina

will launch the Homebrew-installed Python 2 interpreter (if any).

will launch the Homebrew-installed Python 3 interpreter.

If the Homebrew version of Python 2 is installed then pip2 will point to Python 2.If the Homebrew version of Python 3 is installed then pip will point to Python 3.

The rest of the guide will assume that python references Python 3.

Pipenv & Virtual Environments¶

The next step is to install Pipenv, so you can install dependencies and manage virtual environments.

A Virtual Environment is a tool to keep the dependencies required by different projectsin separate places, by creating virtual Python environments for them. It solves the“Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keepsyour global site-packages directory clean and manageable.

For example, you can work on a project which requires Django 1.10 while alsomaintaining a project which requires Django 1.8.

So, onward! To the Pipenv & Virtual Environments docs!

This page is a remixed version of another guide,which is available under the same license.