因为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