티스토리 뷰
작업환경 : 맥북, 구글앱엔진, 파이썬, flask, pip, sqlalchemy...
이전에 데이터베이스 테이블을 업데이트 하려면 맥 터미널에서
python manager.py db migrate
명령어를 이용했었는데
맥북 요세미티 클린설치를 하고나서부터 import 에러가 났다.
그래서 pip를 이용해 찾지 못하는 라이브러리들을 설치해줬는데 결국 마지막에
No module named google.appengine.api
에서 막혔다.
앱엔진을 다시 깔아도 안되고 이건 pip로 해도 안되더라.
몇일을 고생한 끝에 얻은 문제의 실마리는 PYTHONPATH.
이 문제를 해결 하는 방법은 아래 링크에 있었다.
http://stackoverflow.com/questions/15592379/google-app-engine-no-module-named-google-appengine-ext
답변을 인용해 보자면
In your console, type
export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
. This will add it to your PYTHONPATH for this console session.In your shell profile file (perhaps
~/.bash_profile
), add a line like this:export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
Then either open a new console session or reload your profile with
source ~/.bash_profile
(or whatever your file is)
설명해보자면,
1.
In your console, type export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine". This will add it to your PYTHONPATH for this console session.
터미널 열고
export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
를 복사 붙여넣기 하고나서 엔터.
2.
In your shell profile file (perhaps ~/.bash_profile), add a line like this:
export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
Then either open a new console session or reload your profile with source ~/.bash_profile (or whatever your file is)
bash_profile 이라는 것에다가 저 PYTHONPATH를 추가 해주라는 말인데.
내 맥북에는 bash_profile 자체가 없더라. 그래서 새로 만들어 주고 추가해야했었다.
만드는 방법은,
1. 터미널 열고
vi ~/.bash_profile
라고 입력후 엔터
2. esc 한번누르고
:wq
라고 입력후 엔터
그러면, bash_profile이 만들어 졌을거다.
이제 다시 돌아가서
콘솔에
export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
라고 입력하고 엔터치면 됨!
'개발' 카테고리의 다른 글
디지털오션 워드프레스에 HTTPS를 위한 SSL 인증서 설치하고 자동갱신 (auto renew)하기 (0) | 2020.08.25 |
---|---|
아이프레임 내부 form에서 submit후 부모창에서 상태 변화주기 (0) | 2017.09.13 |
Command "python setup.py egg_info" failed with error code 1 in ~~ 에러 (0) | 2017.06.03 |
Homebrew, python2.7 파이썬 설치하기 (0) | 2017.06.03 |
PIP(파이썬 패키지 관리 시스템), FLASK 설치하기 (0) | 2017.06.03 |