首页 > 技术文章 > Python For Mac 开发环境安装 以及问题记录

xiongwj0910 2019-07-06 10:55 原文

Python For Mac 开发环境安装记录

把自己安装的过程记录一下,亲测可用

1.Python3环境安装(转载http://www.cnblogs.com/meng1314-shuai/p/9031686.html)

前言: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

img

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

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

python

img

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

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

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

brew search python3

img

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

brew install python3

==> 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

推荐阅读