---
title: "Come installare Django su Windows"
version: 5.1
locale: it
source: https://docs.djangoproject.com/it/5.1/howto/windows/
canonical: https://djangodocs.dev/it/5.1/howto/windows/
---
# Come installare Django su Windows

This document will guide you through installing Python 3.13 and Django on
Windows. It also provides instructions for setting up a virtual environment,
which makes it easier to work on Python projects. This is meant as a beginner’s
guide for users working on Django projects and does not reflect how Django
should be installed when developing changes for Django itself.

I passaggi in questa guida sono stati testati su Windows 10. Nelle altre versioni, i passaggi dovrebbero essere simili. Potrebbe aiutare una conoscenza del prompt di comandi di Windows.

## Installa Python

Django is a Python web framework, thus requiring Python to be installed on your
machine. At the time of writing, Python 3.13 is the latest version.

Per installare Python sulla tua macchina vai a <https://www.python.org/downloads/>.  Il sito web dovrebbe offrire un pulsante download per l’ultima versione di Python. Scarica l’installer eseguibile e lancialo. Spunta il box vicino a «Install launcher for all users (recommended)» e poi clicca su «Install Now».

After installation, open the command prompt and check that the Python version
matches the version you installed by executing:

```doscon
...\> py --version
```

> **py is not recognized or found**
>
> Depending on how you’ve installed Python (such as via the Microsoft Store),
> `py` may not be available in the command prompt.
>
> You will then need to use `python` instead of `py` when entering
> commands.

> **See also**
>
> Per maggiori dettagli, vedere la documentazione [Using Python on Windows](https://docs.python.org/3/using/windows.html).

## Su `pip`

[pip](https://pypi.org/project/pip/) is a package manager for Python and is included by default with the
Python installer. It helps to install and uninstall Python packages
(such as Django!). For the rest of the installation, we’ll use `pip` to
install Python packages from the command line.

## Impostazione di un ambiente virtuale

È buona norma fornire un ambiente dedicato per ogni progetto Django che crei. Ci sono molte opzioni per gestire ambienti e pacchetti all’interno dell’ecosistema Python, alcune delle quali sono consigliate nella [Documentazione Python](https://packaging.python.org/guides/tool-recommendations/). Python stesso viene fornito con [venv](https://docs.python.org/3/tutorial/venv.html) per la gestione degli ambienti che useremo per questa guida.

To create a virtual environment for your project, open a new command prompt,
navigate to the folder where you want to create your project and then enter the
following:

```doscon
...\> py -m venv project-name
```

This will create a folder called “project-name” if it does not already exist
and set up the virtual environment. To activate the environment, run:

```doscon
...\> project-name\Scripts\activate.bat
```

L’ambiente virtuale verrà attivato e vedrai «(nome-progetto)» accanto al prompt dei comandi per designarlo. Ogni volta che avvii un nuovo prompt dei comandi, dovrai attivare nuovamente l’ambiente.

## Installa Django

Django puo essere installato utilizzando `pip` nel tuo ambiente virtuale.

In the command prompt, ensure your virtual environment is active, and execute
the following command:

```doscon
...\> py -m pip install Django
```

Questo scarichera e installera l’ultima versione di Django

Dopo che l’installazione è stata completata, puoi verificare la tua installazione di Django eseguendo `django-admin --version` nel prompt dei comandi.

Vedere [Get your database running](/it/5.1/topics/install/#database-installation) per informazioni sull’installazione del database con Django.

## Risultato colorato del terminale

Una funzione di qualità della vita aggiunge un output colorato (anziché monocromatico) al terminale. Nei terminali moderni questo dovrebbe funzionare sia per CMD che per PowerShell. Se per qualche motivo questo deve essere disabilitato, imposta la variabile ambientale [`DJANGO_COLORS`](/it/5.1/ref/django-admin/#envvar-DJANGO_COLORS) su `nocolor`.

On older Windows versions, or legacy terminals, [colorama](https://pypi.org/project/colorama/) 0.4.6+ must be
installed to enable syntax coloring:

```doscon
...\> py -m pip install "colorama >= 0.4.6"
```

Vedere [Syntax coloring](/it/5.1/ref/django-admin/#syntax-coloring) per ulteriori informazioni sulle impostazioni del colore.

## Insidie comuni

- Se `django-admin` mostra solo un testo di aiuto, non importa che argomenti gli si diano, probabilmente c’è un problema di associazione di file in Windows. Controlla se c’è più di una variabile di ambiente impostata per lanciare gli script Python in `PATH`. Questo generalmente accade quando c’è più di una versione di Python installata.
- If you are connecting to the internet behind a proxy, there might be problems
  in running the command `py -m pip install Django`. Set the environment
  variables for proxy configuration in the command prompt as follows:

  ```doscon
  ...\> set http_proxy=http://username:password@proxyserver:proxyport
  ...\> set https_proxy=https://username:password@proxyserver:proxyport
  ```
- In generale, Django assume che per l’I/O venga usato l’encoding `UTF-8`. Questo può causare problemi se il tuo sistema è impostato per usare un encoding differente. Versioni recenti di Python permettono di impostare la variabile di ambiente [`PYTHONUTF8`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUTF8) per forzare l’encoding `UTF-8`. Windows 10 offre una impostazione a livello di sistema, spuntando `Usa Unicode UTF-8 per il supporto alle lingue di tutto il mondo` in Lingua ‣ Impostazioni di Amministrazione della Lingua ‣ Cambia il locale del sistema nelle impostazioni di sistema.
