After installing Django, it is important to check whether Django is installed correctly and which version is available in your current Python environment.
Checking the Django version confirms that Django is available in your current Python environment.
It is also useful when troubleshooting installation problems or working with a project that requires a particular Django version.
The simplest command for checking the Django version is:
django-admin --version
If Django is correctly installed, this command displays the installed Django version.
You can also check the Django version through Python:
python -m django --version
This method is especially useful when working with a particular Python environment.
pip can also display information about the installed Django package.
python -m pip show Django
This command provides more information than just the version number.
A successful version command may display output similar to:
5.x
The exact version displayed depends on the version installed in your environment.
Django runs on Python, so checking the Python version can also be useful.
python --version
On systems where Python 3 is accessed as python3, use:
python3 --version
You can also check the installed pip version:
python -m pip --version
This can help determine which Python installation is associated with pip.
If you installed Django inside a virtual environment, activate the environment before checking the version.
On Windows:
venv\Scripts\activate
Then:
python -m django --version
On Linux or macOS, activate the environment first:
source venv/bin/activate
Then check Django:
python -m django --version
You may have more than one Python environment on your computer. One environment may contain Django while another does not.
Therefore, always check the version from the environment used by your Django project.
The following command displays Django package information:
python -m pip show Django
It can show details such as the package name, version, location and dependencies.
You can list installed packages using:
python -m pip list
Look for Django in the displayed package list.
The django-admin command can directly report the Django
version.
django-admin --version
This is a short and commonly used command.
Another reliable command is:
python -m django --version
Here, Python runs Django as a module and asks it to display its version.
| Command | Purpose |
|---|---|
django-admin --version |
Displays the Django version |
python -m django --version |
Displays Django version through Python |
python -m pip show Django |
Displays Django package information |
python -m pip list |
Lists installed Python packages |
If django-admin is not recognized, Django may not be
installed in the current environment or the command may not be available
through the system PATH.
Try checking with:
python -m django --version
If Python reports that the Django module cannot be found, check whether Django is installed in the active environment.
python -m pip show Django
If Django is missing, install it using pip.
If Django is not installed in the active environment, run:
python -m pip install Django
After installation, check the version again.
After installing Django, run:
python -m django --version
The command should now display the installed Django version.
The location of the Django package can be displayed with:
python -m pip show Django
Look for the Location information in the output.
Django projects can depend on particular Django and Python versions.
Before installing or upgrading Django for an existing project, check the project's dependency requirements.
It is useful to verify Django before creating your first project.
python -m django --version
Once the command works, you can continue with Django project creation.
On Windows, you can use:
python --version
python -m django --version
django-admin --version
These commands help check Python and Django from the command prompt.
On Linux or macOS, you can use:
python3 --version
python -m django --version
django-admin --version
Use the Python command that matches your system configuration.
When debugging a Django project, knowing the installed Django version helps identify environment and dependency differences.
You should also check whether the correct virtual environment is active.
If you have multiple Python installations or virtual environments, verify which Python executable is active.
On Windows:
where python
On Linux/macOS:
which python
python --version
python -m django --version
python -m pip show Django
A project's dependencies can be stored in requirements.txt.
You can create the file from the active environment using:
python -m pip freeze > requirements.txt
This records installed package versions for the environment.
If python -m django --version displays a version number,
Django is available to that Python environment.
You are now ready to move forward and create a Django project.
There are several ways to check the installed Django version.
django-admin --version
or:
python -m django --version
For additional package information, use:
python -m pip show Django
Checking the version is an important step before starting Django project development.
django-admin --version displays the Django version.python -m django --version checks Django through Python.python -m pip show Django displays package information.Question: Which command checks the Django version through Python?