1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>virtualenvwrapper 3.3 — virtualenvwrapper v3.3 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '3.3',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="virtualenvwrapper v3.3 documentation" href="#" />
<link rel="next" title="インストール" href="install.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="install.html" title="インストール"
accesskey="N">next</a></li>
<li><a href="#">virtualenvwrapper v3.3 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="virtualenvwrapper-release">
<h1>virtualenvwrapper 3.3<a class="headerlink" href="#virtualenvwrapper-release" title="Permalink to this headline">¶</a></h1>
<p>virtualenvwrapper は Ian Bicking の <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> ツールの拡張機能です。この拡張機能は仮想環境の作成・削除を行ったり、開発ワークフローを管理するラッパーを提供します。このラッパーを使うことで、開発環境の依存関係による競合を起こさず、同時に複数のプロジェクトで作業しやすくなります。</p>
<div class="section" id="id1">
<h2>機能<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>1つの場所に全ての仮想環境を構成する</li>
<li>仮想環境を管理(作成、削除、コピー)するラッパー</li>
<li>1つのコマンドで仮想環境を切り替える</li>
<li>コマンドの引数から仮想環境をタブ補完できる</li>
<li>全ての操作をユーザ設定でフックできる(<a class="reference internal" href="scripts.html#scripts"><em>ユーザカスタマイズ</em></a> を参照)</li>
<li>共有できる拡張機能を作成できるプラグインシステム(<a class="reference internal" href="plugins.html#plugins"><em>virtualenvwrapper を拡張する</em></a> を参照)</li>
</ol>
</div>
<div class="section" id="id2">
<h2>入門<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>virtualenvwrapper が提供する機能を説明するには、実際に使ってみるのが最も良い方法です。</p>
<p>まず初期化の作業があります。この作業の大半は一度だけ行う必要があります。pip でインストールした場所に依存する virtualenvwrapper.sh のパスを変更したり、 <tt class="docutils literal"><span class="pre">source</span> <span class="pre">/usr/local/bin/virtualenvwrapper.sh</span></tt> のコマンドをシェル起動時に読み込まれるファイルへ追加したりするでしょう。</p>
<div class="highlight-python"><pre>$ pip install virtualenvwrapper
...
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv env1
Installing
distribute..........................................
....................................................
....................................................
...............................done.
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/predeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postdeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/preactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postactivate New python executable in env1/bin/python
(env1)$ ls $WORKON_HOME
env1 hook.log</pre>
</div>
<p>これで作成した仮想環境へソフトウェアをインストールできます。</p>
<div class="highlight-python"><pre>(env1)$ pip install django
Downloading/unpacking django
Downloading Django-1.1.1.tar.gz (5.6Mb): 5.6Mb downloaded
Running setup.py egg_info for package django
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
changing mode of /Users/dhellmann/Envs/env1/bin/django-admin.py to 755
Successfully installed django</pre>
</div>
<p><tt class="docutils literal"><span class="pre">lssitepackages</span></tt> で新たにインストールしたパッケージを調べられます。</p>
<div class="highlight-python"><pre>(env1)$ lssitepackages
Django-1.1.1-py2.6.egg-info easy-install.pth
distribute-0.6.10-py2.6.egg pip-0.6.3-py2.6.egg
django setuptools.pth</pre>
</div>
<p>当然、1つだけの仮想環境に制限されるわけではりません。</p>
<div class="highlight-python"><pre>(env1)$ ls $WORKON_HOME
env1 hook.log
(env1)$ mkvirtualenv env2
Installing distribute...............................
....................................................
....................................................
........... ...............................done.
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/predeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postdeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/preactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postactivate New python executable in env2/bin/python
(env2)$ ls $WORKON_HOME
env1 env2 hook.log</pre>
</div>
<p><tt class="docutils literal"><span class="pre">workon</span></tt> で仮想環境を切り替えます。</p>
<div class="highlight-python"><pre>(env2)$ workon env1
(env1)$ echo $VIRTUAL_ENV
/Users/dhellmann/Envs/env1
(env1)$</pre>
</div>
<p>さらに <tt class="docutils literal"><span class="pre">workon</span></tt> コマンドは仮想環境名をタブ補完できます。そして、ある仮想環境がアクティブ化または非アクティブ化されるようにカスタムスクリプトを実行します(<a class="reference internal" href="scripts.html#scripts"><em>ユーザカスタマイズ</em></a> を参照)。</p>
<div class="highlight-python"><pre>(env1)$ echo 'cd $VIRTUAL_ENV' >> $WORKON_HOME/postactivate
(env1)$ workon env2
(env2)$ pwd
/Users/dhellmann/Envs/env2</pre>
</div>
<p>新たな環境が作成されるときに <a class="reference internal" href="scripts.html#scripts-postmkvirtualenv"><em>postmkvirtualenv</em></a> が実行されて、一般的に使用するツールを自動的にインストールします。</p>
<div class="highlight-python"><pre>(env2)$ echo 'pip install sphinx' >> $WORKON_HOME/postmkvirtualenv
(env3)$ mkvirtualenv env3
New python executable in env3/bin/python
Installing distribute...............................
....................................................
....................................................
........... ...............................done.
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/predeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postdeactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/preactivate
virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postactivate
Downloading/unpacking sphinx
Downloading Sphinx-0.6.5.tar.gz (972Kb): 972Kb downloaded
Running setup.py egg_info for package sphinx
no previously-included directories found matching 'doc/_build'
Downloading/unpacking Pygments>=0.8 (from sphinx)
Downloading Pygments-1.3.1.tar.gz (1.1Mb): 1.1Mb downloaded
Running setup.py egg_info for package Pygments
Downloading/unpacking Jinja2>=2.1 (from sphinx)
Downloading Jinja2-2.4.tar.gz (688Kb): 688Kb downloaded
Running setup.py egg_info for package Jinja2
warning: no previously-included files matching '*' found under directory 'docs/_build/doctrees'
Downloading/unpacking docutils>=0.4 (from sphinx)
Downloading docutils-0.6.tar.gz (1.4Mb): 1.4Mb downloaded
Running setup.py egg_info for package docutils
Installing collected packages: docutils, Jinja2, Pygments, sphinx
Running setup.py install for docutils
Running setup.py install for Jinja2
Running setup.py install for Pygments
Running setup.py install for sphinx
no previously-included directories found matching 'doc/_build'
Installing sphinx-build script to /Users/dhellmann/Envs/env3/bin
Installing sphinx-quickstart script to /Users/dhellmann/Envs/env3/bin
Installing sphinx-autogen script to /Users/dhellmann/Envs/env3/bin
Successfully installed docutils Jinja2 Pygments sphinx (env3)$
(venv3)$ which sphinx-build
/Users/dhellmann/Envs/env3/bin/sphinx-build</pre>
</div>
<p>コアパッケージで定義された既存機能(<a class="reference internal" href="command_ref.html#command"><em>コマンドリファレンス</em></a> を参照)、サードパーティのプラグイン(<a class="reference internal" href="plugins.html#plugins"><em>virtualenvwrapper を拡張する</em></a> を参照)やユーザ定義スクリプト(<a class="reference internal" href="scripts.html#scripts"><em>ユーザカスタマイズ</em></a> を参照)を組み合わせて、virtualenvwrapper は雑多な繰り返し行う操作を自動化する機会を提供します。</p>
</div>
<div class="section" id="id3">
<h2>詳細内容<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="install.html">インストール</a><ul>
<li class="toctree-l2"><a class="reference internal" href="install.html#supported-shells">サポートシェル</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#python">Python バージョン</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#install-basic">基本的なインストール</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#install-shell-config">シェルの起動ファイル</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#id6">クイックスタート</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#id7">設定</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#id15">2.9 へのアップグレード</a></li>
<li class="toctree-l2"><a class="reference internal" href="install.html#x">1.x からのアップグレード</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="command_ref.html">コマンドリファレンス</a><ul>
<li class="toctree-l2"><a class="reference internal" href="command_ref.html#id2">仮想環境を管理する</a></li>
<li class="toctree-l2"><a class="reference internal" href="command_ref.html#id3">アクティブな仮想環境を制御する</a></li>
<li class="toctree-l2"><a class="reference internal" href="command_ref.html#id4">仮想環境へ簡単に移動する</a></li>
<li class="toctree-l2"><a class="reference internal" href="command_ref.html#id5">パス管理</a></li>
<li class="toctree-l2"><a class="reference internal" href="command_ref.html#id6">プロジェクトディレクトリの管理</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="hooks.html">virtualenvwrapper をカスタマイズする</a><ul>
<li class="toctree-l2"><a class="reference internal" href="scripts.html">ユーザカスタマイズ</a></li>
<li class="toctree-l2"><a class="reference internal" href="plugins.html">virtualenvwrapper を拡張する</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="projects.html">プロジェクト管理</a><ul>
<li class="toctree-l2"><a class="reference internal" href="projects.html#id2">テンプレートの利用</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tips.html">Tips とトリック</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tips.html#zsh">zsh プロンプト</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#path">キャッシュされた <tt class="docutils literal"><span class="pre">$PATH</span></tt> エントリを更新する</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#pip-virtualenv">pip の virtualenv サポート</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#id2">プロジェクトのワークディレクトリを作成する</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#workon">ディレクトリへ移動したときに自動的に workon を実行する</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#id3">新しい環境に共通ツールを自動的にインストールする</a></li>
<li class="toctree-l2"><a class="reference internal" href="tips.html#cd"><tt class="docutils literal"><span class="pre">cd</span></tt> のデフォルトの振る舞いを変更する</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="developers.html">開発者向け</a><ul>
<li class="toctree-l2"><a class="reference internal" href="developers.html#id2">ドキュメントを作成する</a></li>
<li class="toctree-l2"><a class="reference internal" href="developers.html#id3">テストを実行する</a></li>
<li class="toctree-l2"><a class="reference internal" href="developers.html#developer-templates">新しいテンプレートの作成</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="extensions.html">既存の拡張機能</a><ul>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#emacs-desktop">emacs-desktop</a></li>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#user-scripts">user_scripts</a></li>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#vim-virtualenv">vim-virtualenv</a></li>
<li class="toctree-l2"><a class="reference internal" href="extensions.html#extensions-templates">テンプレート</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="history.html">リリース履歴</a></li>
</ul>
</div>
<span class="target" id="references"></span></div>
<div class="section" id="id4">
<h2>参考文献<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<p>Ian Bicking の <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> が virtualenvwrapper の拡張機能を使用するために必須です。</p>
<p>さらに詳細は私が書いた2008年5月の Python マガジンのコラムを参照してください。
<a class="reference external" href="http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html">virtualenvwrapper | ところで話は変わりますが</a></p>
<p>Rich Leland は virtualenvwrapper の機能を誇示するために短い <a class="reference external" href="http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/">スクリーンキャスト</a> を作成しました。</p>
<p>Manuel Kaufmann は <a class="reference external" href="http://www.doughellmann.com/docs/virtualenvwrapper/es/">このドキュメントをスペイン語に翻訳しました</a> 。</p>
<p>Tetsuya Morimoto は <a class="reference external" href="http://www.doughellmann.com/docs/virtualenvwrapper/ja/">このドキュメントを日本語に翻訳しました</a> 。</p>
</div>
<div class="section" id="id6">
<h2>サポート<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
<p>問題や機能を議論するには <a class="reference external" href="http://groups.google.com/group/virtualenvwrapper/">virtualenvwrapper Google Group</a> に参加してください。</p>
<p><a class="reference external" href="http://bitbucket.org/dhellmann/virtualenvwrapper/">BitBucket のバグトラッカー</a> でバグを報告してください。</p>
<div class="section" id="id7">
<h3>シェルエイリアス<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h3>
<p>virtualenvwrapper は大きなシェルスクリプトなので、多くのアクションはシェルコマンドを使用します。あなたの環境が多くのシェルエイリアスやその他のカスタマイズを行っているなら、何かしら問題に遭遇する可能性があります。バグトラッカーにバグを報告する前に、そういったエイリアスを無効な <em>状態</em> でテストしてください。あなたがその問題を引き起こすエイリアスを判別できるなら virtualenvwrapper をもっと堅牢なものにすることに役立つでしょう。</p>
</div>
</div>
<div class="section" id="license">
<span id="id8"></span><h2>ライセンス<a class="headerlink" href="#license" title="Permalink to this headline">¶</a></h2>
<p>Copyright Doug Hellmann, All Rights Reserved</p>
<p>Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Doug Hellmann not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.</p>
<p>DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="#">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">virtualenvwrapper 3.3</a><ul>
<li><a class="reference internal" href="#id1">機能</a></li>
<li><a class="reference internal" href="#id2">入門</a></li>
<li><a class="reference internal" href="#id3">詳細内容</a><ul>
</ul>
</li>
<li><a class="reference internal" href="#id4">参考文献</a></li>
<li><a class="reference internal" href="#id6">サポート</a><ul>
<li><a class="reference internal" href="#id7">シェルエイリアス</a></li>
</ul>
</li>
<li><a class="reference internal" href="#license">ライセンス</a></li>
</ul>
</li>
</ul>
<h4>Next topic</h4>
<p class="topless"><a href="install.html"
title="next chapter">インストール</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="install.html" title="インストール"
>next</a></li>
<li><a href="#">virtualenvwrapper v3.3 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2009-2011, Doug Hellmann.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.5.
</div>
</body>
</html>
|