笔者从今天开始进行Python3的学习,先从Python3的环境搭建开始。
Python3在Mac上的安装:
Mac系统默认的Python版本号是2.7,由于Python3不向下兼容,所以我们需要重新安装Python3。
两种安装方式:
1、从 https://www.python.org 官网下载 Python3的安装包,双击安装。
2、用 Homebrew 安装。
笔者使用了后者进行安装。
brew install python3
提示如下:
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/python3-3.6.3.high_sierra.b
######################################################################## 100.0%
==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
看到提示,首先想到的是权限问题:
所以依靠经验,改成如下:
sudo brew install python3
终端提示如下:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
意思是说 Homebrew 不允许使用sudo命令
经过google,找到了解决办法:
sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks
至此,Python3总算安装到Mac上了,接下来开始配置开发环境了,请看下篇。
网友评论