[英]How to re-enter my virtual environment using cmd in windows
I have created a virtual environment for django using cmd我已经使用 cmd 为 django 创建了一个虚拟环境
pip install virtualenvwrapper-win
mkvirtualenv test
and here I have installed Django using在这里我安装了 Django 使用
pip install django
But suppose I close my cmd prompt and restart it.但是假设我关闭了 cmd 提示并重新启动它。 What is the command to re-enter in the (test) environment that I have created.
重新进入我创建的(测试)环境的命令是什么。
If you are using the package virtualenvwrapper-win
, then you can use the options described in this part of the docs :如果您使用的是 package
virtualenvwrapper-win
,那么您可以使用文档的这一部分中描述的选项:
workon [<name>]
If
<name>
is specified, activate the environment named<name>
(change the working virtualenv to<name>
).如果指定了
<name>
,则激活名为<name>
的环境(将工作的 virtualenv 更改为<name>
)。 If a project directory has been defined, we will change into it.如果已定义项目目录,我们将更改为该目录。 If no argument is specified, list the available environments.
如果未指定参数,请列出可用环境。 One can pass additional option
-c
after virtualenv name to cd to virtualenv directory if no projectdir is set.如果没有设置 projectdir,可以在 virtualenv 名称之后将附加选项
-c
传递给 cd 到 virtualenv 目录。
To reactivate the virtual environment: Virtualenvname\Scripts\activate.bat Eg:testing\Scripts\activate.bat This will opens your virtual environment to use.重新激活虚拟环境: Virtualenvname\Scripts\activate.bat 例如:testing\Scripts\activate.bat 这将打开您的虚拟环境以供使用。
To create a virtual environment open command prompt/terminal and navigate to the directory where you want to create your Django project.
要创建虚拟环境,请打开命令提示符/终端并导航到要创建 Django 项目的目录。 Let's say we want to create our project at 'user/hp/' then we'll navigate to the 'user/hp/' and then type the command below.
假设我们想在“user/hp/”创建我们的项目,然后我们将导航到“user/hp/”,然后键入下面的命令。
Install the virtual environment
安装虚拟环境
Create a virtual environment
创建虚拟环境
C:\Users\hp\mkvirtualenv jangoProject
To activate env type the below command.
要激活 env,请键入以下命令。
C:\Users\hp\jangoProject\Scripts\activate
To deactivate env type the below command
要停用 env,请键入以下命令
To create a new project type below code
在代码下方创建一个新的项目类型
C:\User\hp\django-admin startproject learn1 C:\用户\hp\django-admin startproject learn1
to re entering the same virtual environment created earlier one should firstly change to the directory where virtual environment is created using the CD(directory).要重新进入之前创建的虚拟环境,首先要切换到使用光盘创建虚拟环境的目录(目录)。 and later change in to the project directory and then change to SCRIPTS and at that moment use the command ACTIVATE to activate the virtual environment.
然后切换到项目目录,然后切换到 SCRIPTS,此时使用命令 ACTIVATE 激活虚拟环境。
steps:脚步:
follow the above steps to reactivate virtual environment.按照上述步骤重新激活虚拟环境。
To activate previously created environment, just type the following command in your anaconda prompt:要激活先前创建的环境,只需在 anaconda 提示符下键入以下命令:
conda activate 'name_of_the_environment'
Voila.瞧。 You are now on your virtual environment.
您现在处于虚拟环境中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.