用brew upgrade pythonMac系统自带python2.7升级为3.6

MacBook-Pro:~ sunyifeng$ brew upgrade python
==> Upgrading 1 outdated package, with result:
python 3.6.4_4
==> Upgrading python
==> Installing dependencies for python: gdbm, openssl, sqlite, xz
==> Installing python dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.14.1_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.14.1_1.high_sierra.bottle.tar.gz
  /usr/local/Cellar/gdbm/1.14.1_1: 20 files, 555.7KB
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2n.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2n.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs

and run
/usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
/usr/local/Cellar/openssl/1.0.2n: 1,792 files, 12.3MB
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.22.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.22.0.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
  /usr/local/Cellar/sqlite/3.22.0: 11 files, 3MB
==> Installing python dependency: xz
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.3.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring xz-5.2.3.high_sierra.bottle.tar.gz
  /usr/local/Cellar/xz/5.2.3: 92 files, 1.4MB
==> Installing python
==> Downloading https://homebrew.bintray.com/bottles/python-3.6.4_4.high_sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring python-3.6.4_4.high_sierra.bottle.1.tar.gz
==> /usr/local/Cellar/python/3.6.4_4/bin/python3 -s setup.py --no-user-cfg install --force --verbose
==> /usr/local/Cellar/python/3.6.4_4/bin/python3 -s setup.py --no-user-cfg install --force --verbose
==> /usr/local/Cellar/python/3.6.4_4/bin/python3 -s setup.py --no-user-cfg install --force --verbose
==> 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 python@2

Pip, setuptools, and wheel have been installed. To update them run
pip3 install --upgrade pip setuptools wheel

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

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
/usr/local/Cellar/python/3.6.4_4: 4,667 files, 98.3MB

用python命令查看版本

已经可以安装多个版本

发布了57 篇原创文章 · 获赞 59 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/mrsyf/article/details/79692783