2011年12月3日土曜日

Python virtualenv環境でIDLE


このエントリーをはてなブックマークに追加


virtualenvのワーク環境でIDLEを起動しても、ワークの環境を読み込んでくれずOS標準環境になってしまう。
IDLE 2.6.6      
>>> import sys
>>> sys.path
['/opt/swift', '/usr/bin', '/usr/lib/python2.6/site-packages/virtualenv-1.7-py2.6.egg', '/usr/lib/python2.6/site-packages/virtualenvwrapper-2.10.1-py2.6.egg', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

IDLEをvirtualenv下で使うには以下の手順。

IDLE起動ファイル
# vim ~/idle.py
from idlelib.PyShell import main
if __name__ == '__main__':
  main()

(work)# python ~/idle.py
IDLE 2.6.6      
>>> import sys
>>> sys.path
['/opt/swift', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib/python2.6/site-packages/pip-1.0.2-py2.6.egg', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python26.zip', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python2.6', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python2.6/plat-linux2', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python2.6/lib-tk', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python2.6/lib-old', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib64/python2.6/lib-dynload', '/usr/lib/python2.6', '/usr/lib64/python2.6', '/usr/lib64/python2.6/lib-tk', '/opt/swift/.virtualenvs/swift-1.4.4-dev/lib/python2.6/site-packages']

0 件のコメント:

コメントを投稿