[Django] How to check the installed version of Django

In the process of typing the code, sometimes you will encounter an error when the program is running. After checking it around, it may be because the version of the plug-in is not compatible with the python version;

Here is a record of how to query the installed version of Django, determine whether there may be compatibility issues, and avoid stepping on the pit in advance

Method 1: Enter the command in the terminal of the editor (here takes pycharm as an example)

Click on the terminal at the bottom of the editor

 Enter the command django-admin --version, the version queried here is the version of Django installed in the current environment ( not the version of Django installed globally ), which is applicable to the created and configured virtual environment

The installation path is: /Users/xmly/.local/share/virtualenvs/dev_dj-ROpzLBsg /lib/python3.8/site-packages/Django-4.2.1.dist-info 

The red mark is the path of the virtual environment

 Method 2: Query by entering commands in the terminal

This query shows the version of Django installed globally in the python environment, not the version of Django installed in the specified virtual environment.

open terminal

Enter Python to enter the Python interpreter

Enter the command import django

Enter the command print(django.VERSION)

 

The path is: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/Django-3.2.2.dist-info 

Guess you like

Origin blog.csdn.net/weixin_43569834/article/details/131202324