前言:mac系统自带python,不过以当前mac系统的最新版本为例,自带的python版本都是2.*版本,虽然不影响老版本项目的运行,但是python最新的3.*版本的一些语法与2.*版本并不相同,网上的教程大神们也肯定都更新出了最新版的教程,我们不论是学习还是使用,当然用最新版会更好一点。

转载请注明出处http://www.cnblogs.com/meng1314-shuai/p/9031686.html

1、在安装最新版Python3.*之前,我们先熟悉一下系统自带的python。

  Mac系统自带python路径为/System/Library/Frameworks/Python.framework/Version,我们先来打开目录看一下:

open /System/Library/Frameworks/Python.framework/Versions

我们看到这里有多个python版本,而在Current目录下存放的是系统当前的python版本。

mac既然自带了python,当然肯定配置好了python的全局命令,我们直接在终端运行:

python

 

 运行正常。到这里也差不多对mac系统自带的python有所了解,接下来我们开始安装最新版本的python。

 2、开始安装(这里我们使用神器homebrew,还不熟悉此神器的小伙伴请自行百度,也可点击链接直接前往下载)

安装前先搜索一下是否已经存在python3的包:

brew search python3

已经存在,我们可以直接安装了:

brew install python3

p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1); background-color: rgba(255, 255, 255, 1) }
p.p2 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1); background-color: rgba(255, 255, 255, 1); min-height: 13px }
span.s1 { font-variant-ligatures: no-common-ligatures; color: rgba(82, 48, 225, 1) }
span.s2 { font-variant-ligatures: no-common-ligatures }
span.s3 { font-variant-ligatures: no-common-ligatures; color: rgba(52, 188, 38, 1) }
span.s4 { font-variant-ligatures: no-common-ligatures; color: rgba(175, 173, 36, 1) }
span.s5 { font-variant-ligatures: no-common-ligatures; color: rgba(195, 55, 32, 1) }

==> Auto-updated Homebrew!

Updated 1 tap (homebrew/core).

==> Updated Formulae

angular-cli     fluent-bit      links           postgresql@9.6  texmath

byacc           fn              mlt             qcachegrind     tile38

caddy           ipython         osrm-backend    rhino           wtf

cfitsio         ipython@5       postgresql      siril

cfssl           libpq           postgresql@9.4  sundials

dnscrypt-proxy  libpqxx         postgresql@9.5  synfig

 

==> Installing dependencies for python: sphinx-doc, gdbm, openssl, sqlite, xz

==> Installing python dependency: sphinx-doc

==> Downloading https://homebrew.bintray.com/bottles/sphinx-doc-1.7.4.high_sierr

######################################################################## 100.0%

==> Pouring sphinx-doc-1.7.4.high_sierra.bottle.tar.gz

==> Caveats

This formula is keg-only, which means it was not symlinked into /usr/local,

because this formula is mainly used internally by other formulae.

Users are advised to use `pip` to install sphinx-doc.

 

If you need to have this software first in your PATH run:

  echo \’export PATH=”/usr/local/opt/sphinx-doc/bin:$PATH”\’ >> ~/.bash_profile

 

==> Summary

版权声明:本文为meng1314-shuai原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/meng1314-shuai/p/9031686.html