___  ___    _ _    _  _ _____   _____
 / __|/ _ \  | | |  | || |_ _\ \ / / __|
| (_ | (_) | |_  _| | __ || | \ V /| _|
 \___|\___/    |_|  |_||_|___| \_/ |___|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

python/pip 버전 변경하기 - MacPorts & python_select

BY: @dextto | CREATED: Nov. 17, 2018, 11:44 a.m. | VOTES: 1 | PAYOUT: $0.00 | [ VOTE ]

Mac OS의 기본 python 명령어는 python 2.x로 매핑되어 되어 있습니다. 회사에서 쓰는 버전이 3.x 인데 매번 python3 명령어를 쓰려니 귀찮습니다.
virtualenv나 pipenv를 활용해도 됩니다만 기본 콘솔에서 가상환경으로 매번 바꿔줘야 합니다. 역시 귀찮습니다.

이럴 경우 python_select를 이용해서 python 버전을 변경하는 방법이 있어 소개합니다.

현재 Mojave 10.14.1를 사용하고 있습니다.

이 사이트를 참고했습니다.
- https://superuser.com/questions/35256/how-can-i-change-the-default-python-version-on-snow-leopard
- https://machinelearningmastery.com/install-python-3-environment-mac-os-x-machine-learning-deep-learning/

먼저 MacPorts를 설치합니다.
https://www.macports.org/install.php 에서 자신의 맥과 맞는 버전을 찾아 설치합니다. 상세한 설명은 생략합니다.

터미널을 띄우고 다음 순서대로 따라 합니다.

python

잘 되어 있군요. 그럼 이제 python 명령어가 잘 먹히는지 봐야죠

$ python --version
Python 3.7.1

pip

이제 pip명령어도 pip3버전으로 맞춰줍시다.

$ sudo port install py37-pip
$ sudo port select --set pip pip3

P.S) MacPorts 버전이 낮을 경우 port select가 아니가 python_select로 해야하는 듯 하네요.

끝! :)

TAGS: [ #mac ] [ #tip ] [ #python ] [ #python-select ]

Replies

@steemitboard | Oct. 2, 2019, 12:19 a.m. | Votes: 0 | [ VOTE ]

Congratulations @dextto! You received a personal award!

https://steemitimages.com/70x70/http://steemitboard.com/@dextto/birthday1.pngHappy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!
[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>