Revised Windows install instructions for Python 3.5.

Added instructions for installing virtualenv and virtualenvwrapper.
This commit is contained in:
Tim Allen 2015-10-01 10:57:12 -04:00 committed by Tim Graham
parent 0f6d51e6a0
commit 1ce11f6064
1 changed files with 50 additions and 38 deletions

View File

@ -2,62 +2,75 @@
How to install Django on Windows How to install Django on Windows
================================ ================================
This document will guide you through installing Python and Django for basic This document will guide you through installing Python 3.5 and Django on
usage on Windows. This is meant as a beginner's guide for users working on Windows. It also provides instructions for installing `virtualenv`_ and
Django projects and does not reflect how Django should be installed when `virtualenvwrapper`_, which make it easier to work on Python projects. This is
developing patches for Django itself. meant as a beginner's guide for users working on Django projects and does not
reflect how Django should be installed when developing patches for Django
itself.
The steps in this guide have been tested with Windows 7 and 8. In other The steps in this guide have been tested with Windows 7, 8, and 10. In other
versions, the steps would be similar. versions, the steps would be similar. You will need to be familiar with using
the Windows command prompt.
Install Python Install Python
============== ==============
Django is a Python web framework, thus requiring Python to be installed on your Django is a Python web framework, thus requiring Python to be installed on your
machine. machine. At the time of writing, Python 3.5 is the latest version.
To install Python on your machine go to https://python.org/download/, and To install Python on your machine go to https://python.org/downloads/. The Web
download a Windows MSI installer for Python. Once downloaded, run the MSI site should offer you a download button for the latest Python version. Download
installer and follow the on-screen instructions. the executable installer and run it. Check the box next to ``Add Python 3.5 to
PATH`` and then click ``Install Now``.
After installation, open the command prompt and check the Python version by After installation, open the command prompt and check that the Python version
executing ``python --version``. If you encounter a problem, make sure you matches the version you installed by executing::
have set the ``PATH`` variable correctly. You might need to adjust your
``PATH`` environment variable to include paths to the Python executable and
additional scripts. For example, if your Python is installed in
``C:\Python34\``, the following paths need to be added to ``PATH``::
C:\Python34\;C:\Python34\Scripts; python --version
Install Setuptools About pip
================== =========
To install Python packages on your computer, Setuptools is needed. Download the `pip`_ is a package manage for Python. It makes installing and uninstalling
latest version of `Setuptools <https://pypi.python.org/pypi/setuptools>`_ for Python packages (such as Django!) very easy. For the rest of the installation,
your Python version and follow the installation instructions given there. we'll use ``pip`` to install Python packages from the command line.
Install PIP .. _pip: https://pypi.python.org/pypi/pip
===========
`PIP <https://pip.pypa.io/>`_ is a package manager for Python that Install ``virtualenv`` and ``virtualenvwrapper``
uses the `Python Package Index <https://pypi.python.org>`_ to install Python ================================================
packages. PIP will later be used to install Django from PyPI. If you've
installed Python 3.4, ``pip`` is included so you may skip this section.
Open a command prompt and execute ``easy_install pip``. This will install `virtualenv`_ and `virtualenvwrapper`_ provide a dedicated environment for
``pip`` on your system. This command will work if you have successfully each Django project you create. While not mandatory, this is considered a best
installed Setuptools. practice and will save you time in the future when you're ready to deploy your
project. Simply type::
Alternatively, go to `<https://pip.pypa.io/en/latest/installing.html>`_ pip install virtualenvwrapper-win
for installing/upgrading instructions.
Then create a virtual environment for your project::
mkvirtualenv myproject
The virtual environment will be activated automatically and you'll see
"(myproject)" next to the command prompt to designate that. If you start a new
command prompt, you'll need to activate the environment again using::
workon myproject
.. _virtualenv: https://pypi.python.org/pypi/virtualenv
.. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrapper-win
Install Django Install Django
============== ==============
Django can be installed easily using ``pip``. Django can be installed easily using ``pip``.
In the command prompt, execute the following command: ``pip install django``. In the command prompt, execute the following command::
This will download and install Django.
pip install django
This will download and install the latest Django release.
After the installation has completed, you can verify your Django installation After the installation has completed, you can verify your Django installation
by executing ``django-admin --version`` in the command prompt. by executing ``django-admin --version`` in the command prompt.
@ -75,9 +88,8 @@ Common pitfalls
than one Python version installed. than one Python version installed.
* If you are connecting to the internet behind a proxy, there might be problem * If you are connecting to the internet behind a proxy, there might be problem
in running the commands ``easy_install pip`` and ``pip install django``. in running the command ``pip install django``. Set the environment variables
Set the environment variables for proxy configuration in the command prompt for proxy configuration in the command prompt as follows::
as follows::
set http_proxy=http://username:password@proxyserver:proxyport set http_proxy=http://username:password@proxyserver:proxyport
set https_proxy=https://username:password@proxyserver:proxyport set https_proxy=https://username:password@proxyserver:proxyport