Mac 下 安装Python3

因为Mac系统自带Python2.7 所以我们开发要重新装Python3

直接运行下面就好

luohaotiandeMacBook-Pro:~ luohaotian$ which python
/usr/bin/python
luohaotiandeMacBook-Pro:~ luohaotian$ cd /usr/local/bin/
luohaotiandeMacBook-Pro:bin luohaotian$ ls
brew        lz4     perlthanks  ptardiff    svnrdump
cnpm        lz4c        piconv      ptargrep    svnserve
corelist    lz4cat      pl2pm       shasum      svnsync
cpan        node        pod2html    splain      svnversion
enc2xs      npm     pod2man     svn     unlz4
encguess    npx     pod2text    svnadmin    vue
h2ph        perl        pod2usage   svnbench    vue-init
h2xs        perl5.30.0  podchecker  svndumpfilter   vue-list
instmodsh   perlbug     podselect   svnfsfs     webpack
json_pp     perldoc     prove       svnlook     xsubpp
libnetcfg   perlivp     ptar        svnmucc     zipdetails
luohaotiandeMacBook-Pro:bin luohaotian$ python -V
Python 2.7.10
luohaotiandeMacBook-Pro:bin luohaotian$ brew search python3
==> Formulae
boost-python3              python3                    [email protected]
luohaotiandeMacBook-Pro:bin luohaotian$ brew install python3
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
jdupes                                   mk-configure

==> Installing dependencies for python: gdbm and xz
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.mojave.bottle.1
######################################################################## 100.0%
==> Pouring gdbm-1.18.1.mojave.bottle.1.tar.gz
??  /usr/local/Cellar/gdbm/1.18.1: 20 files, 586.8KB
==> Installing python dependency: xz
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.4.mojave.bottle.tar.
==> Downloading from https://akamai.bintray.com/01/010667293df282c8bceede3bcd369
######################################################################## 100.0%
==> Pouring xz-5.2.4.mojave.bottle.tar.gz
??  /usr/local/Cellar/xz/5.2.4: 92 files, 1MB
==> Installing python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.3.mojave.bottle.
==> Downloading from https://akamai.bintray.com/25/25e0099852136c4ef1efd221247d0
######################################################################## 100.0%
==> Pouring python-3.7.3.mojave.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install [email protected]

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
??  /usr/local/Cellar/python/3.7.3: 3,863 files, 59.8MB
==> Caveats
==> python
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install [email protected]

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
luohaotiandeMacBook-Pro:bin luohaotian$ brew info python3
python: stable 3.7.3 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.7.3 (3,863 files, 59.8MB) *
  Poured from bottle on 2019-06-04 at 18:24:52
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ?
Required: gdbm ?, openssl ?, readline ?, sqlite ?, xz ?
==> Options
--HEAD
    Install HEAD version
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install [email protected]

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Analytics
install: 378,873 (30 days), 1,357,511 (90 days), 4,253,975 (365 days)
install_on_request: 181,954 (30 days), 660,530 (90 days), 2,431,795 (365 days)
build_error: 0 (30 days)
luohaotiandeMacBook-Pro:bin luohaotian$ 

原文地址:https://www.cnblogs.com/adrien/p/10975362.html

时间: 2024-10-08 07:23:47

Mac 下 安装Python3的相关文章

mac下安装Python3.*(最新版本)

前言:mac系统自带python,不过以当前mac系统的最新版本为例,自带的python版本都是2.*版本,虽然不影响老版本项目的运行,但是python最新的3.*版本的一些语法与2.*版本并不相同,网上的教程大神们也肯定都更新出了最新版的教程,我们不论是学习还是使用,当然用最新版会更好一点. 转载请注明出处http://www.cnblogs.com/meng1314-shuai/p/9031686.html 1.在安装最新版Python3.*之前,我们先熟悉一下系统自带的python.  M

mac下安装python3

准备mac上装个python3  下面来看下怎么安装 打开dos窗口 我用的是iterm2,打开窗口 网上说需要安装 xcode(装个就是个编译器 无所谓额,一般做ios开发) homebrew  有点像composer,下载一个哦,下载命令是: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 装完运行一下 查看是否安装成功 brew doctor 如果提

mac下安装Python3.7(最新版本)

前言:mac系统自带python,不过以当前mac系统的最新版本为例,自带的python版本都是2.版本,虽然不影响老版本项目的运行,但是python最新的3.版本的一些语法与2.*版本并不相同,网上的教程大神们也肯定都更新出了最新版的教程,我们不论是学习还是使用,当然用最新版会更好一点. 1.在安装最新版Python3.*之前,我们先熟悉一下系统自带的python. Mac系统自带python路径为/System/Library/Frameworks/Python.framework/Vers

Mac下安装Python3.x版本

1. Mac系统自带了Python 2.x版本:可在终端输入python进行查看,输入exit() 退出: 2. Python的3.x版本与2.x版本语法并不相同,目前学习的是廖雪峰老师的教程,该教程以3.7版本为基础,因此进行了3.7版本的安装: 从Python官网下载Python 3.7.0或者3.7.1的安装程序,双击运行并安装: 安装完成后,在终端输入python3,如下图,则安装成功. PS:此种方式安装python3.x后,终端输入python仍然默认显示python2.x,输入py

mac上安装python3 和 sqlite的问题

建议mac上安装python3不要使用源码自己编译安装,而要使用 brew install python3 来安装 另外安装完之后创建需环境的话,要指定新的python环境,如下: virtualenv  -p /usr/local/Cellar/python3/3.6.2/bin/python3  --no-site-packages obpy17 Mac OSX 正确地同时安装Python 2.7 和Python3 Mac OSX 正确地同时安装Python 2.7 和Python3(这个是

Mac下安装lightgbm

Mac下安装lightgbm 1.安装环境 系统 MacOS Mojave 版本10.14.2 Xcode 10.1 $ clang -v Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix 2.安装错误 直接使用命令: import lightgbm as lgb 使用时直接调用: import lightgbm as lgb import li

mac下安装mongoDB

方式一:命令行 MongoDB的安装有好多种安装方法,有普通青年的HomeBrew方式,也有文艺青年的源码编译方式.我只想快速的装起来用一下,所以我选最简单的HomeBrew. 请参考官方文档 : http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ 更新Homebrew的package数据库,在Mac的终端中输入: $ brew update 然后耐心等待,这个没有任何显示,估计要几分钟,取决于网络的速度.然后就列出了

mac下安装配置java开发环境

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Helvetica; color: #000000 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Helvetica; color: #000000; min-height: 13.0px } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #

Mac下安装LNMP(Nginx+PHP5.6)环境

Mac下安装LNMP(Nginx+PHP5.6)环境 安装Homebrew 最近工作环境切换到Mac,所以以OS X Yosemite(10.10.1)为例,记录一下从零开始安装Mac下LNMP环境的过程 确保系统已经安装xcode,然后使用一行命令安装依赖管理工具Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 之后就可以使用 brew