Python 버전 문제, Mac, Sublime text

잊기전에 포스팅.

맥에서 터미널을 통해 설치한 파이썬 라이브러리가 Sublime text의 REPL에서는 import되지 않는 문제가 발생했었다.

문제의 시작은 다음과 같다.

 

Seok-ui-MacBook-Pro:~ Seok$ /usr/local/bin/python
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> exit()

Seok-ui-MacBook-Pro:~ Seok$ /usr/bin/python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> exit()

 

/usr/bin/python과 /usr/local/bin/python이 다른 버전이었던 것.

Sublime text의 python은 /usr/bin/python과 같은 버전이었다.

이 부분을 수정하는 방법은 찾지 못하여, 아예 터미널에서 기본으로 python을 실행할때 뜨는 버전을

.bash_profile을 수정하여 /usr/bin/python으로 고정시켰다.

 

Seok-ui-MacBook-Pro:~ Seok$ vi .bash_profile
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
# PATH=”/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}”
PATH=”/usr/bin:${PATH}”
export PATH

 

원래있던 3번째 줄 앞에 주석처리를 해놓고, 4번째 줄로 바꿔서 작성

이후에 다시 라이브러리를 설치했더니 잘 돌아간다.

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.