Python3安装完全攻略 Mac篇( 五 )


12、检查
$ brew doctor
Ps:其实查出一堆,不过不影响安装,这里暂时不细究了 。
13、更换的默认源:
直接使用还需要更改默认源,不然谁用谁想打人,原因你懂的 。
以下是将默认源替换为国内 USTC 源的方法 。
替换核心软件仓库
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)
$ cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
源( 预编译二进制软件包) bash(默认 shell)用户:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile$ source ~/.bash_profile
zsh 用户:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc$ source ~/.zshrc
14、再次搜索的包
安装前先搜索一下是否已经存在的包:
$ brew search python3
结果:
==> Formulaeboost-python3python3python@3
【Python3安装完全攻略 Mac篇】已经存在,我们可以直接安装了 。
15、再次安装
$ brew install python3
安装成功:
#以上省略一堆安装信息==> pythonPython has been installed as/usr/local/bin/python3Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to`python3`, `python3-config`, `pip3` etc., respectively, have been installed into/usr/local/opt/python/libexec/binIf you need Homebrew's Python 2.7 runbrew install python@2You can install Python packages withpip3 install They will install into the site-package directory/usr/local/lib/python3.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
16、查看当前系统下的的信息
$ brew info python3
python: stable 3.7.5 (bottled), HEADInterpreted, interactive, object-oriented programming languagehttps://www.python.org//usr/local/Cellar/python/3.7.5 (3,972 files, 61.0MB) *Poured from bottle on 2019-11-21 at 18:59:08From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/python.rb==> DependenciesBuild: pkg-config ?Required: gdbm ?, openssl@1.1 ?, readline ?, sqlite ?, xz ?==> Options--HEADInstall HEAD version==> CaveatsPython has been installed as/usr/local/bin/python3Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to`python3`, `python3-config`, `pip3` etc., respectively, have been installed into/usr/local/opt/python/libexec/binIf you need Homebrew's Python 2.7 runbrew install python@2You can install Python packages withpip3 install They will install into the site-package directory/usr/local/lib/python3.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
17、查看pip
有同学可能想看下pip是否安装成功,可以用
$ pip list
查看是否安装了pip 。
三、让Mac 默认使用
mac一般自带.7
可以修改 ~/. (具体的path取决于你的安装路径):