Note that the python path is not the same as the system $PATH.
(1) To list the python path,
import sys
print(sys.path)
(2) To insert a path,
sys.path.insert(0, '{PATH TO INSERT}')
This enables one to import library from other folder.
2017년 8월 21일 월요일
2016년 6월 10일 금요일
ipython install for OSX El Capitan
컴퓨터를 Mac 으로 바꾸고 ipython 을 설치하려니 문제가 생겼다.
먼저 pip install ipython 을 시도했지만, pip 가 설치되어 있지 않음.
그래서 일단 pip 를 설치.( sudo easy_install pip )
다시 pip 로 ipython 을 설치하려 했지만, 실패.
아마도 Apple의 정책상 시스템과 관련된 디렛토리에 쓰는 것이 금지 된 듯.
이번에는 sudo easy_install ipython 을 시도했으나 역시 에러 발생. (six 라는
프로그램의 버전이 문제인 듯.)
결국 다음과 같은 방법으로 설치 성공. (설치하는 김에 python3도 설치했다.)
sudo pip install haxor-news --upgrade --ignore-installed six
2014년 8월 3일 일요일
ipython autoreload
Class 나 file 을 import 한 뒤에 수정한 뒤 다시 import 를 해도 수정된 결과가 적용이 안되는 경우 ipython 에서는 쉽게 해결할 수 있다.
다음과 같이 autoreload 라는 ipython magic 을 사용하면 된다.
다음과 같이 autoreload 라는 ipython magic 을 사용하면 된다.
In [1]: %load_ext autoreload In [2]: %autoreload 2 In [3]: from foo import some_function In [4]: some_function() Out[4]: 42 In [5]: # open foo.py in an editor and change some_function to return 43 In [6]: some_function() Out[6]: 43
피드 구독하기:
글 (Atom)