기본 맥북에 2.7 버전이 다운이 되어 있습니다.
기본 파이썬 버전을 2.7 에서 최신 3.xx 버젼으로 다운 받아서 바꾸려고 합니다.
Homebrew 설치
macOS 용 패키지 관리자를 하기 링크를 통해서 다운 받습니다.
Homebrew
The Missing Package Manager for macOS (or Linux).
brew.sh
command + space 입력 -> terminal.app 실행 -> brew insall python 타이핑
실행결과
% brew install python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and mongodb/brew).
==> New Formulae
cloudiscovery ld-find-code-refs sextractor
iputils nsh
==> Updated Formulae
Updated 1397 formulae.
==> New Casks
fmail otto-matic threema trackerzapper
mural scatter topnotch
==> Updated Casks
Updated 172 casks.
==> Deleted Casks
refined-github-safari
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/manifests/1.21_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/blobs/sha256:fd3c1830264b7
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/manifests/2.5.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/blobs/sha256:eebbc5c7
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2021-
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:1b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1l_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:e3d855
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.1.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:bcb228b99
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.36.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:b7d98dc89e3
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.2.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:c84206005787304
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/manifests/3.9.7_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/blobs/sha256:c1955f1
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for python@3.9: gdbm, mpdecimal, ca-certificates, openssl@1.1, readline, sqlite and xz
==> Installing python@3.9 dependency: gdbm
==> Pouring gdbm--1.21_1.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/gdbm/1.21_1: 24 files, 991.2KB
==> Installing python@3.9 dependency: mpdecimal
==> Pouring mpdecimal--2.5.1.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/mpdecimal/2.5.1: 71 files, 2.2MB
==> Installing python@3.9 dependency: ca-certificates
==> Pouring ca-certificates--2021-10-26.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺 /opt/homebrew/Cellar/ca-certificates/2021-10-26: 3 files, 208.5KB
==> Installing python@3.9 dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1l_1.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1: 8,073 files, 18MB
==> Installing python@3.9 dependency: readline
==> Pouring readline--8.1.1.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/readline/8.1.1: 48 files, 1.7MB
==> Installing python@3.9 dependency: sqlite
==> Pouring sqlite--3.36.0.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/sqlite/3.36.0: 11 files, 4.3MB
==> Installing python@3.9 dependency: xz
==> Pouring xz--5.2.5.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/xz/5.2.5: 95 files, 1.4MB
==> Installing python@3.9
==> Pouring python@3.9--3.9.7_1.arm64_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/python@3.9/3.9.7_1/bin/python3 -m ensurepip
==> /opt/homebrew/Cellar/python@3.9/3.9.7_1/bin/python3 -m pip install -v --no-d
==> Caveats
Python has been installed as
/opt/homebrew/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/opt/homebrew/opt/python@3.9/libexec/bin
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/opt/homebrew/lib/python3.9/site-packages
tkinter is no longer included with this formula, but it is available separately:
brew install python-tk@3.9
See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /opt/homebrew/Cellar/python@3.9/3.9.7_1: 3,082 files, 56.6MB
==> Caveats
==> python@3.9
Python has been installed as
/opt/homebrew/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/opt/homebrew/opt/python@3.9/libexec/bin
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/opt/homebrew/lib/python3.9/site-packages
tkinter is no longer included with this formula, but it is available separately:
brew install python-tk@3.9
See: https://docs.brew.sh/Homebrew-and-Python
아직 기본 python을 설치 했을 때, 2.7 버젼이 보입니다.
하기 주석처리된 부분을 입력하면 최신 버전으로 나오는 것을 확인 하실 수 있습니다.
% python --version
Python 2.7.16
% python3 --version
Python 3.9.7
'''
% cd ~
% echo alias python="python3" > ~/.bash_profile
% source ~/.bash_profile
'''
% python --version
Python 3.9.7
반응형