{"title":"FAQ：安装","version":"3.1","locale":"zh-hans","docname":"faq/install","url":"/zh-hans/3.1/faq/install/","canonical":"https://djangodocs.dev/zh-hans/3.1/faq/install/","summary":"如何开始？ Link to this heading # 下载代码 。 安装 Django （阅读 安装指南 ）。 查看 教程第 1 部分 。 阅读剩下的指南</index>，如果你遇到任何问题，提问是一个不错的解决方法。 使用 Django，需要做好什么准备？ Link to this heading # Django…","html":"<h1>FAQ：安装<a class=\"heading-anchor\" href=\"#faq-installation\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"how-do-i-get-started\">\n<h2>如何开始？<a class=\"heading-anchor\" href=\"#how-do-i-get-started\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ol class=\"arabic simple\">\n<li><p><a class=\"reference external\" href=\"https://www.djangoproject.com/download/\">下载代码</a> 。</p></li>\n<li><p>安装 Django （阅读 <a class=\"reference internal\" href=\"/zh-hans/3.1/intro/install/\"><span class=\"doc\">安装指南</span></a>）。</p></li>\n<li><p>查看 <a class=\"reference internal\" href=\"/zh-hans/3.1/intro/tutorial01/\"><span class=\"doc\">教程第 1 部分</span></a> 。</p></li>\n<li><p>阅读剩下的指南&lt;/index&gt;，如果你遇到任何问题，提问是一个不错的解决方法。</p></li>\n</ol>\n</section>\n<section id=\"what-are-django-s-prerequisites\">\n<h2>使用 Django，需要做好什么准备？<a class=\"heading-anchor\" href=\"#what-are-django-s-prerequisites\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django 要求先安装 Python。参见下个问题中的表格，它介绍了各个 Django 版本所支持的 Python 版本。某些情况下可能需要一些额外的 Python 库，如果未安装，你会在这些库被用到时获得一个错误提示。</p>\n<p>对于开放环境而言——如果你想要试验一下 Django——你不需要有一个独立的已安装的 Web 服务器或数据库服务器。</p>\n<p>Django 自带了 <a class=\"reference internal\" href=\"/zh-hans/3.1/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">轻量级开发服务器</span></code></a>. 对于生产环境， Django 遵循 WSGI 规范, <span class=\"target\" id=\"index-2\"></span><a class=\"pep reference external\" href=\"https://peps.python.org/pep-3333/\"><strong>PEP 3333</strong></a>, 这意味着它可以运行在各种 web 服务平台上. 详情见 <a class=\"reference internal\" href=\"/zh-hans/3.1/howto/deployment/\"><span class=\"doc\">Deploying Django</span></a> 。</p>\n<p>Django 默认使用 <a class=\"reference external\" href=\"https://www.sqlite.org/\">SQLite</a> , 它随着 Python 一起安装。在生产环境中, 我们推荐使用 <a class=\"reference external\" href=\"https://www.postgresql.org/\">PostgreSQL</a>; 但是我们同样支持 <a class=\"reference external\" href=\"https://mariadb.org/\">MariaDB</a>、<a class=\"reference external\" href=\"https://www.mysql.com/\">MySQL</a>,、<a class=\"reference external\" href=\"https://www.sqlite.org/\">SQLite</a> 和 <a class=\"reference external\" href=\"https://www.oracle.com/\">Oracle</a>. 详情参见 <a class=\"reference internal\" href=\"/zh-hans/3.1/ref/databases/\"><span class=\"doc\">Supported Databases</span></a> 。</p>\n</section>\n<section id=\"what-python-version-can-i-use-with-django\">\n<span id=\"faq-python-version-support\"></span><h2>我应该使用哪个版本的 Python 来配合 Django?<a class=\"heading-anchor\" href=\"#what-python-version-can-i-use-with-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Django 版本</p></th>\n<th class=\"head\"><p>Python 版本</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p>1.11</p></td>\n<td><p>2.7, 3.4, 3.5, 3.6, 3.7 (1.11.17 添加)</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p>2.0</p></td>\n<td><p>3.4，3.5，3.6，3.7</p></td>\n</tr>\n<tr class=\"row-even\"><td><p>2.1</p></td>\n<td><p>3.5，3.6，3.7</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p>2.2</p></td>\n<td><p>3.5，3.6，3.7，3.8（2.2.8 添加），3.9（2.2.17 添加）</p></td>\n</tr>\n<tr class=\"row-even\"><td><p>3.0</p></td>\n<td><p>3.6，3.7，3.8，3.9 （3.0.11 添加）</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p>3.1</p></td>\n<td><p>3.6，3.7，3.8，3.9（3.1.3 添加）</p></td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>对于每个版本的Python，官方仅支持最新的三级版本（A.B.C）。你可以在 <a class=\"reference external\" href=\"https://www.python.org/downloads/\">Python下载页面</a> 找到每个系列的微版本。</p>\n<p>一般来说，我们会支持一个 Python 版本直到其第一个发布的 Django LTS 安全支持停止。而 Django LTS 版本安全支持停止是跟随这其对应版本的 Python 安全支持结束的。例如，Python 3.3 安全支持在 2017 年 9 月结束，然后 Django 1.8 LTS 安全支持在 2018 年 4 月结束。因此 Django 1.8 是支持 Python 3.3 的最后一版。</p>\n</section>\n<section id=\"what-python-version-should-i-use-with-django\">\n<h2>我应该选用什么版本的 Python 来使用 Django ？<a class=\"heading-anchor\" href=\"#what-python-version-should-i-use-with-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>我们推荐 Python 3。Django 1.11 是支持 Python 2.7 的最后一版。Python 2.7 和 Django 1.11 的支持将会在2020年结束。</p>\n<p>因为新版本的 Python 通常会更快，拥有更多特性，而且有更好的支持，推荐使用 Python 3 的最新版本。</p>\n<p>使用旧版本的 Django 不会损失任何东西，但你不能利用新版本的 Python 的改进和优化。与 Django 一起使用的第三方应用程序可以自由设置自己的版本要求。</p>\n</section>\n<section id=\"should-i-use-the-stable-version-or-development-version\">\n<h2>我应该使用稳定版本还是开发版本？<a class=\"heading-anchor\" href=\"#should-i-use-the-stable-version-or-development-version\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>一般来说，如果你在生产中使用 Django，你应该使用稳定版本。Django 每 9 个月发布一次稳定版本，之后会间断发布修复补丁的版本。这些稳定版本包含的 API 都是向后兼容的；如果你是按照稳定版本来进行编写代码，那你在下一个正式版本升级的时候不应该出现问题。</p>\n</section>","rootId":"faq-installation","toc":[{"title":"如何开始？","anchor":"how-do-i-get-started","children":[]},{"title":"使用 Django，需要做好什么准备？","anchor":"what-are-django-s-prerequisites","children":[]},{"title":"我应该使用哪个版本的 Python 来配合 Django?","anchor":"what-python-version-can-i-use-with-django","children":[]},{"title":"我应该选用什么版本的 Python 来使用 Django ？","anchor":"what-python-version-should-i-use-with-django","children":[]},{"title":"我应该使用稳定版本还是开发版本？","anchor":"should-i-use-the-stable-version-or-development-version","children":[]}],"breadcrumbs":[{"docname":"faq/index","title":"Django FAQ","url":"/zh-hans/3.1/faq/"}],"prev":{"docname":"faq/general","title":"FAQ：概述","url":"/zh-hans/3.1/faq/general/"},"next":{"docname":"faq/usage","title":"FAQ: 使用Django","url":"/zh-hans/3.1/faq/usage/"},"formats":{"html":"/zh-hans/3.1/faq/install/","markdown":"/zh-hans/3.1/faq/install.md","json":"/zh-hans/3.1/faq/install.json"},"source":"https://github.com/django/django/blob/stable/3.1.x/docs/faq/install.txt","official":"https://docs.djangoproject.com/zh-hans/3.1/faq/install/","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"],"inLocales":["en","zh-hans","fr","ja","id","pt-br","ko","es","el","pl"]}