{"title":"Windows での Django のインストール方法","version":"1.11","locale":"ja","docname":"howto/windows","url":"/ja/1.11/howto/windows/","canonical":"https://djangodocs.dev/ja/1.11/howto/windows/","summary":"This document will guide you through installing Python 3.5 and Django on Windows.","html":"<h1>Windows での Django のインストール方法<a class=\"heading-anchor\" href=\"#how-to-install-django-on-windows\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>This document will guide you through installing Python 3.5 and Django on\nWindows. It also provides instructions for installing <a class=\"reference external\" href=\"https://pypi.python.org/pypi/virtualenv\">virtualenv</a> and\n<a class=\"reference external\" href=\"https://pypi.python.org/pypi/virtualenvwrapper-win\">virtualenvwrapper</a>, which make it easier to work on Python projects. This is\nmeant as a beginner's guide for users working on Django projects and does not\nreflect how Django should be installed when developing patches for Django\nitself.</p>\n<p>The steps in this guide have been tested with Windows 7, 8, and 10. In other\nversions, the steps would be similar. You will need to be familiar with using\nthe Windows command prompt.</p>\n<section id=\"install-python\">\n<h2>Python をインストールする<a class=\"heading-anchor\" href=\"#install-python\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django は Python のウェブフレームワークなので、コンピュータには Python がインストールしておく必要があります。この記事を書いている時点では、Python 3.5 が最新版です。</p>\n<p>To install Python on your machine go to <a class=\"reference external\" href=\"https://python.org/downloads/\">https://python.org/downloads/</a>. The\nwebsite should offer you a download button for the latest Python version.\nDownload the executable installer and run it. Check the box next to <code class=\"docutils literal notranslate\">Add\nPython 3.5 to PATH</code> and then click <code class=\"docutils literal notranslate\">Install Now</code>.</p>\n<p>インストール後、コマンドプロンプトを開き、次のコマンドを実行して、Python のバージョンが今インストールしたバージョンと一致するかどうか確認します。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>python <span class=\"o\">--</span>version\n</code></pre></div>\n</section>\n<section id=\"about-pip\">\n<h2>About <code class=\"docutils literal notranslate\">pip</code><a class=\"heading-anchor\" href=\"#about-pip\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"reference external\" href=\"https://pypi.python.org/pypi/pip\">pip</a> は Python のパッケージマネージャです。<a class=\"reference external\" href=\"https://pypi.python.org/pypi/pip\">pip</a> を使えば、Python のパッケージ (たとえば Django のような！) のインストールやアンインストールが非常に簡単に行えます。インストールのセクションでは、これ以降コマンドラインから <code class=\"docutils literal notranslate\">pip</code> を使って Python のパッケージをインストールします。</p>\n<p>To install pip on your machine, go to\n<a class=\"reference external\" href=\"https://pip.pypa.io/en/latest/installing/\">https://pip.pypa.io/en/latest/installing/</a>, and follow the <code class=\"docutils literal notranslate\">Installing with\nget-pip.py</code> instructions.</p>\n</section>\n<section id=\"install-virtualenv-and-virtualenvwrapper\">\n<h2><code class=\"docutils literal notranslate\">virtualenv</code> と <code class=\"docutils literal notranslate\">virtualenvwrapper</code> のインストール<a class=\"heading-anchor\" href=\"#install-virtualenv-and-virtualenvwrapper\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"reference external\" href=\"https://pypi.python.org/pypi/virtualenv\">virtualenv</a> と <a class=\"reference external\" href=\"https://pypi.python.org/pypi/virtualenvwrapper-win\">virtualenvwrapper</a> は、作成した Django プロジェクトごとに専用の環境を用意してくれるパッケージです。プロジェクト用の環境を作るのは必須ではありませんが、ベストプラクティスだと考えられていて、将来自分のプロジェクトをデプロイしようとするときに無駄な時間を費やすのを防いでくれます。まずは、次のコマンドを実行しましょう。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>pip install virtualenvwrapper<span class=\"o\">-</span>win\n</code></pre></div>\n<p>そして、次のコマンドでプロジェクト用の仮想環境を作成します。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>mkvirtualenv myproject\n</code></pre></div>\n<p>仮想環境は自動的に有効 (activate) にされ、コマンドプロンプトの隣に、仮想環境内にいることを示す &quot;(myproject)&quot; という文字列が表示されるはずです。新しいコマンドプロンプトを始めるには、次のコマンドを用いて、もう一度環境を有効にする必要があります。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>workon myproject\n</code></pre></div>\n</section>\n<section id=\"install-django\">\n<h2>Django をインストールする<a class=\"heading-anchor\" href=\"#install-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django can be installed easily using <code class=\"docutils literal notranslate\">pip</code> within your virtual environment.</p>\n<p>In the command prompt, ensure your virtual environment is active, and execute\nthe following command:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>pip install django\n</code></pre></div>\n<p>これにより、Django の最新版のリリースがダウンロードされ、インストールされます。</p>\n<p>インストールが完了したら、コマンドプロンプトで <code class=\"docutils literal notranslate\">django-admin --version</code> というコマンドを実行することで、Django が正しくインストールされたかどうかを確認することができます。</p>\n<p>Django とともにデータベースをインストールするための情報については、 <a class=\"reference internal\" href=\"/ja/1.11/topics/install/#database-installation\"><span class=\"std std-ref\">データベースを動かす</span></a> を参照してください。</p>\n</section>\n<section id=\"common-pitfalls\">\n<h2>よくある落とし穴<a class=\"heading-anchor\" href=\"#common-pitfalls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul>\n<li><p>どんな引数を与えても <code class=\"docutils literal notranslate\">django-admin</code> がヘルプテキストしか表示してくれない場合、Windows のファイルの関連付けに問題がある可能性があります。<code class=\"docutils literal notranslate\">PATH</code> に Python のスクリプトを実行するのに必要な環境変数が2つ以上設定されていないかどうか確認してください。2つ以上のバージョンの Python をインストールした時にこの問題が起こることがあります。</p></li>\n<li><p>プロキシ経由でインターネットに接続している場合、<code class=\"docutils literal notranslate\">pip install django</code> というコマンドを実行する時にエラーが表示される場合があります。その場合には、コマンドプロンプトに次のコマンドを入力して、プロキシの設定用の環境変数を設定してください。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"nb\">set</span> http_proxy<span class=\"o\">=</span>http<span class=\"p\">:</span><span class=\"o\">//</span>username<span class=\"p\">:</span>password<span class=\"nd\">@proxyserver</span><span class=\"p\">:</span>proxyport\n<span class=\"nb\">set</span> https_proxy<span class=\"o\">=</span>https<span class=\"p\">:</span><span class=\"o\">//</span>username<span class=\"p\">:</span>password<span class=\"nd\">@proxyserver</span><span class=\"p\">:</span>proxyport\n</code></pre></div>\n</li>\n</ul>\n</section>","rootId":"how-to-install-django-on-windows","toc":[{"title":"Python をインストールする","anchor":"install-python","children":[]},{"title":"About pip","anchor":"about-pip","children":[]},{"title":"virtualenv と virtualenvwrapper のインストール","anchor":"install-virtualenv-and-virtualenvwrapper","children":[]},{"title":"Django をインストールする","anchor":"install-django","children":[]},{"title":"よくある落とし穴","anchor":"common-pitfalls","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"「How-to」ガイド","url":"/ja/1.11/howto/"}],"prev":{"docname":"howto/static-files/deployment","title":"静的ファイルのデプロイ","url":"/ja/1.11/howto/static-files/deployment/"},"next":{"docname":"howto/writing-migrations","title":"データベースのマイグレーションを書く","url":"/ja/1.11/howto/writing-migrations/"},"formats":{"html":"/ja/1.11/howto/windows/","markdown":"/ja/1.11/howto/windows.md","json":"/ja/1.11/howto/windows.json"},"source":"https://github.com/django/django/blob/stable/1.11.x/docs/howto/windows.txt","official":"https://docs.djangoproject.com/ja/1.11/howto/windows/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","fr","ja","id","pt-br","ko","es","el","pl"]}