如何在 windows 中使用 cmd 重新进入我的虚拟环境
How to re-enter my virtual environment using cmd in windows
我已经使用 cmd 为 django 创建了一个虚拟环境
pip install virtualenvwrapper-win
mkvirtualenv test
这里我使用
安装了 Django
pip install django
但是假设我关闭了 cmd 提示符并重新启动它。重新进入我创建的(测试)环境的命令是什么
如果您使用的是包 virtualenvwrapper-win
,那么您可以使用 this part of the docs:
中描述的选项
workon [<name>]
If <name>
is specified, activate the environment named <name>
(change the working virtualenv to <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.
要重新激活虚拟环境:
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. 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.
Install the virtual environment
Create a virtual environment
C:\Users\hp\mkvirtualenv jangoProject
To activate env type the below command.
C:\Users\hp\jangoProject\Scripts\activate
To deactivate env type the below command
To create a new project type below code
C:\User\hp\django-admin startproject learn1
我已经使用 cmd 为 django 创建了一个虚拟环境
pip install virtualenvwrapper-win
mkvirtualenv test
这里我使用
安装了 Django pip install django
但是假设我关闭了 cmd 提示符并重新启动它。重新进入我创建的(测试)环境的命令是什么
如果您使用的是包 virtualenvwrapper-win
,那么您可以使用 this part of the docs:
workon [<name>]
If
<name>
is specified, activate the environment named<name>
(change the working virtualenv to<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.
要重新激活虚拟环境: 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. 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.
Install the virtual environment
Create a virtual environment
C:\Users\hp\mkvirtualenv jangoProject
To activate env type the below command.
C:\Users\hp\jangoProject\Scripts\activate
To deactivate env type the below command
To create a new project type below code
C:\User\hp\django-admin startproject learn1