Django无法识别

问题描述 投票:0回答:1
        pip list

        absl-py                      2.1.0
        anaconda                     0.0.1.1
        asgiref                      3.8.1
        astunparse                   1.6.3
        beautifulsoup4               4.12.3
        bs4                          0.0.2
        certifi                      2024.2.2
        charset-normalizer           3.3.2
        click                        8.1.7
        colorama                     0.4.6
        contourpy                    1.2.1
        cycler                       0.12.1
        Django                       5.0.6
        flatbuffers                  24.3.25
        fonttools                    4.51.0
        gast                         0.5.4
        google-pasta                 0.2.0
        grpcio                       1.62.2
        h5py                         3.11.0
        idna                         3.7
        joblib                       1.4.0
        keras                        3.3.2
        kiwisolver                   1.4.5
        libclang                     18.1.1
        lxml                         5.2.2
        Markdown                     3.6
        markdown-it-py               3.0.0
        MarkupSafe                   2.1.5
        matplotlib                   3.8.4
        mdurl                        0.1.2
        ml-dtypes                    0.3.2
        mpmath                       1.3.0
        namex                        0.0.8
        nltk                         3.8.1
        numpy                        1.26.4
        opt-einsum                   3.3.0
        optree                       0.11.0
        packaging                    24.0
        pandas                       2.2.2
        pillow                       10.3.0
        pip                          24.0
        protobuf                     4.25.3
        pyfiglet                     1.0.2
        Pygments                     2.17.2
        pyparsing                    3.1.2
        Python                       3.11.4
        python-dateutil              2.9.0.post0
        pytz                         2024.1
        regex                        2024.5.10
        requests                     2.31.0
        rich                         13.7.1
        scikit-learn                 1.4.2
        scipy                        1.13.0
        six                          1.16.0
        soupsieve                    2.5
        sqlparse                     0.5.0
        style                        1.1.0
        tensorboard                  2.16.2
        tensorboard-data-server      0.7.2
        tensorflow                   2.16.1
        tensorflow-intel             2.16.1
        tensorflow-io-gcs-filesystem 0.31.0
        termcolor                    2.4.0
        Theano                       1.0.5
        threadpoolctl                3.4.0
        tqdm                         4.66.4
        typing_extensions            4.11.0
        tzdata                       2024.1
        update                       0.0.1
        urllib3                      2.2.1
        Werkzeug                     3.0.2
        wheel                        0.43.0
        wrapt                        1.16.0

我正在上一门编码课程,我将在其中学习有关 Django 的所有知识。由此看来,我对 Django 的一切都是新手是正确的。在课程中,我必须安装 Django。导师说用我电脑的终端来安装Django。他还说安装 Django 2.0.2,因为这是他将使用的版本。他让我使用的命令是

pip3 install django==2.0.2
。一切都安装正常,但是当我尝试用
Django-admin
打开Django时,我遇到了这个错误:
django: The term 'django' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我尝试卸载 Django,然后使用以下命令安装最新版本:

pip install Django
,但即使一切都安装完美,当我尝试使用 Django 启动新项目时,我仍然遇到相同的错误。我还收到了 Bing AI Copilot 给我的替代命令,例如:
python -m Django startproject first_project
,但这会产生相同类型的错误。我想知道为什么 Django 不工作。我使用的是 Windows 11、Dell Inspiron 16 Plus,我想知道这些错误是否是我的设备或操作系统造成的。我给课程讲师发了电子邮件,但尚未收到回复。课程讲师使用 MacOS,他没有给出任何针对 Windows 设备的特殊命令。询问 Bing AI Copilot,它一直告诉我尝试
python -m django startproject first_project
django-admin.py
django-admin
,而我不断收到相同类型的错误,告诉我我的命令无法识别。

python django windows
1个回答
0
投票

我建议您使用 venv

创建一个环境变量

并尝试在那里进行安装,我知道一个 youtube 频道可以帮助在 Windows 系统中正确安装 python 和 django

你可以在这里查看他

© www.soinside.com 2019 - 2024. All rights reserved.