본문 바로가기

Python & Django & Flask

[Python] OSX에서 python 2.7에서 3.3으로 업데이트하기

http://wolfpaulus.com/jounal/mac/installing_python_osx/


1. 우선 python3.3을 설치한다.

 - http://www.python.org/


2. pkg파일을 실행하여 설치하면 아래의 위치에 설치된다.

 - /Library/Frameworks/Python.framework/Versions/3.3


3. /System/Library/Frameworks/Python.framework/Versions 디렉토리로 이동하면, 2.X대의 파이썬 디렉토리가 보인다. 2.7까지는 아직 많이 사용하니 그냥 두어도 무방.


4. sudo mv /Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions


5. sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.3


6. sudo rm /System/Library/Frameworks/Python.framework/Versions/Current


7. sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions/Current


8. sudo rm /usr/bin/pydoc

    sudo rm /usr/bin/python

    sudo rm /usr/bin/pythonw

    sudo rm /usr/bin/python-config


9. ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3.3 /usr/bin/pydoc

ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3.3 /usr/bin/pydoc3.3


ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 /usr/bin/python3.3
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 /usr/bin/python

ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3 /usr/bin/pythonw
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3 /usr/bin/pythonw3.3

ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3-config /usr/bin/python-config
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3-config /usr/bin/python3.3-config

(/usr/bin/ 디렉토리를 보면 2.X별로 링크가 걸려있으므로 그렇게 해놔도 될듯하다.)