在为 Django 创建虚拟环境时无法弄清楚如何解决这个问题

如何解决在为 Django 创建虚拟环境时无法弄清楚如何解决这个问题

在使用 Django 时如何解决这个问题:无法打开文件 '/home/student/back_ends/venv':[Errno 2] 没有这样的文件或目录

解决方法

如果你发现任何问题问我,我已经在 cmd 上完成了所有设置并复制了我的所有命令 此外,请根据 设置环境变量并在谷歌上查看 Microsoft Windows [版本 10.0.19043.1110] (c) 微软公司。保留所有权利。

C:\Users\Dell>python --version
Python 3.8.5

C:\Users\Dell>django --version
'django' is not recognized as an internal or external command,operable program or batch file.

C:\Users\Dell>pip --version
pip 20.2.4 from C:\Users\Dell\anaconda3\lib\site-packages\pip (python 3.8)

C:\Users\Dell>pip install virtualenv
Collecting virtualenv
  Downloading virtualenv-20.6.0-py2.py3-none-any.whl (5.3 MB)
     |████████████████████████████████| 5.3 MB 45 kB/s
Requirement already satisfied: filelock<4,>=3.0.0 in c:\users\dell\anaconda3\lib\site-packages (from virtualenv) (3.0.12)
Requirement already satisfied: six<2,>=1.9.0 in c:\users\dell\anaconda3\lib\site-packages (from virtualenv) (1.15.0)
Collecting platformdirs<3,>=2
  Downloading platformdirs-2.0.2-py2.py3-none-any.whl (10 kB)
Collecting backports.entry-points-selectable>=1.0.4
  Downloading backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl (6.2 kB)
Collecting distlib<1,>=0.3.1
  Downloading distlib-0.3.2-py2.py3-none-any.whl (338 kB)
     |████████████████████████████████| 338 kB 76 kB/s
Installing collected packages: platformdirs,backports.entry-points-selectable,distlib,virtualenv
Successfully installed backports.entry-points-selectable-1.1.0 distlib-0.3.2 platformdirs-2.0.2 virtualenv-20.6.0

C:\Users\Dell>python -m venv DjangoFolder

C:\Users\Dell>DjangoFolder\Scripts\activate

(DjangoFolder) C:\Users\Dell>python -m pip install django
Collecting django
  Using cached Django-3.2.5-py3-none-any.whl (7.9 MB)
Collecting pytz
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse>=0.2.2
  Using cached sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting asgiref<4,>=3.3.2
  Using cached asgiref-3.4.1-py3-none-any.whl (25 kB)
Installing collected packages: pytz,sqlparse,asgiref,django
Successfully installed asgiref-3.4.1 django-3.2.5 pytz-2021.1 sqlparse-0.4.1
WARNING: You are using pip version 20.1.1; however,version 21.2.1 is available.
You should consider upgrading via the 'C:\Users\Dell\DjangoFolder\Scripts\python.exe -m pip install --upgrade pip' command.

(DjangoFolder) C:\Users\Dell>DjangoFolder\Scripts\python.exe -m pip install --upgrade pip
Collecting pip
  Downloading pip-21.2.1-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 49 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1.1
    Uninstalling pip-20.1.1:
      Successfully uninstalled pip-20.1.1
Successfully installed pip-21.2.1

(DjangoFolder) C:\Users\Dell>cd DjangoFolder

(DjangoFolder) C:\Users\Dell\DjangoFolder>cd lib

(DjangoFolder) C:\Users\Dell\DjangoFolder\Lib>cd site-packages

(DjangoFolder) C:\Users\Dell\DjangoFolder\Lib\site-packages>python -m django --version
3.2.5

(DjangoFolder) C:\Users\Dell\DjangoFolder\Lib\site-packages>cd ..

(DjangoFolder) C:\Users\Dell\DjangoFolder\Lib>cd ..

(DjangoFolder) C:\Users\Dell\DjangoFolder>python -m startproject mysite
C:\Users\Dell\DjangoFolder\Scripts\python.exe: No module named startproject

(DjangoFolder) C:\Users\Dell\DjangoFolder>cd mysite
The system cannot find the path specified.

(DjangoFolder) C:\Users\Dell\DjangoFolder>python -m django startproject mysite

(DjangoFolder) C:\Users\Dell\DjangoFolder>cd mysite

(DjangoFolder) C:\Users\Dell\DjangoFolder\mysite>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin,auth,contenttypes,sessions.
Run 'python manage.py migrate' to apply them.
July 25,2021 - 23:49:45
Django version 3.2.5,using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

(DjangoFolder) C:\Users\Dell\DjangoFolder\mysite>python manage.py migrate
Operations to perform:
  Apply all migrations: admin,sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_000`enter code here`2... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK

(DjangoFolder) C:\Users\Dell\DjangoFolder\mysite>python manage.py makemigrations
No changes detected

(DjangoFolder) C:\Users\Dell\DjangoFolder\mysite>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 25,2021 - 23:50:46
Django version 3.2.5,using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK
[25/Jul/2021 23:53:33] "GET / HTTP/1.1" 200 10697
[25/Jul/2021 23:53:34] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[25/Jul/2021 23:53:35] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[25/Jul/2021 23:53:35] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
[25/Jul/2021 23:53:35] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
Not Found: /favicon.ico
[25/Jul/2021 23:53:37] "GET /favicon.ico HTTP/1.1" 404 2110[enter image description here][1]

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?