The latest version of the MacOS Sierra default Python environment is still 2.7.10, this article describes the use of brew installation python3.5 and simple configuration to create a PYTHON2,PYTHON3 coexistence development environment
Try the brew installation directly, prompting you to perform a brew link gdbm
Follow the prompts to execute the brew link gdbm, prompting for directory permissions issues
thatsitdemacbook-pro:~ thatsit$ Brew link gdbmlinking/usr/local/cellar/gdbm/1.12...error:could not symlink share/man/ MAN3/GDBM.3/USR/LOCAL/SHARE/MAN/MAN3 is not writable.thatsitdemacbook-pro:~ thatsit$
Try sudo to perform brew, prompting for root permission is no longer supported
Confirm Directory Permissions and adjust
thatsitdemacbook-pro:~ thatsit$ ll/usr/local/share/man/man3/total 240-rw-rw-r--1 root wheel 25111 1 cdt.3-rw-rw- r--1 root Wheel 27894 1 cgraph.3-rw-rw-r--1 root Wheel 1762 1 expr.3-rw-rw-r--1 root wheel 2103 1 12 20 gvc.3-rw-rw-r--1 root Wheel 2966 1 gvpr.3-rw-rw-r--1 root wheel 9628 1 pack.3-rw-rw-r--1 root wheel 5386 1 pathplan.3-rw-rw-r--1 root wheel 15026 1 tcldot.3tcl-rw-rw-r--1 root wheel 7109 1 Tksplin e.3tk-rw-rw-r--1 root wheel 8157 1 xdot.3thatsitdemacbook-pro:~ thatsit$ thatsitdemacbook-pro:~ thatsit$ sudo cho Wn-r thatsit/usr/local/share/man/man3/thatsitdemacbook-pro:~ thatsit$
Execute again, OK
thatsitdemacbook-pro:~ thatsit$ Brew Link gdbmlinking/usr/local/cellar/gdbm/1.12 ... Symlinks createdthatsitdemacbook-pro:~ thatsit$thatsitdemacbook-pro:~ thatsit$ Brew Install python3==> Installing dependencies for python3:xz==> installing Python3 dependency:xz==> downloading https:// homebrew.bintray.com/bottles/xz-5.2.2.el_capitan.bottle.tar.gz################################################ ######################## 100.0%==> pouring xz-5.2.2.el_capitan.bottle.tar.gzerror:the ' brew link ' step did not Complete Successfullythe formula built, but isn't symlinked into/usr/localcould not symlink lib/pkgconfig/liblzma.pc/usr /local/lib/pkgconfig is not writable. Can you try again using:brew link xz==> Summary?? /usr/local/cellar/xz/5.2.2:91 files, 1.4m==> installing python3==> downloading https://homebrew.bintray.com/ bottles/python3-3.5.2_3.el_capitan.bottle.tar.gz############################################################## ########## 100.0%j==> Pouring PythoN3-3.5.2_3.el_capitan.bottle.tar.gzerror:the ' Brew link ' step did not complete successfullythe formula built; symlinked into/usr/localcould not symlink lib/pkgconfig/python-3.5.pc/usr/local/lib/pkgconfig are not writable. You can try again using:brew link python3==> using the sandbox==>/usr/local/cellar/python3/3.5.2_3/bin/python3-s s etup.py--no-user-cfg Install--force--verbose--install-scripts=/usr/local/cellar/python3/3.5.2_3/bin-- Install-lib=/usr/local/lib/python3.5/site-packages--single-version-externally-managed--record=installed.txt== >/usr/local/cellar/python3/3.5.2_3/bin/python3-s setup.py--no-user-cfg Install--force--verbose-- Install-scripts=/usr/local/cellar/python3/3.5.2_3/bin--install-lib=/usr/local/lib/python3.5/site-packages-- Single-version-externally-managed--record=installed.txt==>/usr/local/cellar/python3/3.5.2_3/bin/python3-s setup.py--no-user-cfg Install--force--verbose--install-scripts=/usr/local/cellar/python3/3.5.2_3/bIn--install-lib=/usr/local/lib/python3.5/site-packages--single-version-externally-managed--record= Installed.txt==> Caveatspip, Setuptools, and wheel have been installed. To update thempip3 install--upgrade pip setuptools wheelyou can install Python packages WITHPIP3 Install <package>t Hey'll install into the site-package directory/usr/local/lib/python3.5/site-packagessee:https://github.com/ Homebrew/brew/blob/master/docs/homebrew-and-python.md.app bundles were installed. Run ' Brew Linkapps python3 ' to symlink these to/applications.==> Summary?? /usr/local/cellar/python3/3.5.2_3:3,498 files, 53.3mthatsitdemacbook-pro:~ thatsit$
Adding PYTHON3 Environment variables
thatsitdemacbook-pro:~ thatsit$ tail-1/etc/profileexport path=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ local/cellar/python3/3.5.2_3/binthatsitdemacbook-pro:~ thatsit$
Test
Thatsitdemacbook-pro:bin thatsit$ Pythonpython 2.7.10 (default, OCT, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0 .0 (clang-700.0.59.5)] on Darwintype ' help ', ' copyright ', ' credits ' or ' license ' for more information.>>> ^dthats Itdemacbook-pro:bin thatsit$ Python3python 3.5.2 (default, OCT, 05:05:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (c lang-800.0.38)] on Darwintype ' help ', ' copyright ', ' credits ' or ' license ' for more information.>>> Thatsitdemacbook-pro:bin thatsit$
Done
Mac builds Python2 PYTHON3 development environment