Leo*_*chi 1 virtualenv virtualenvwrapper virtual-environment
我正在尝试使用Windows 10命令提示符创建和激活虚拟环境。我知道virtualenv作为命令正确安装
virtualenv venv
Run Code Online (Sandbox Code Playgroud)
作品。我已经导航到我的virtualenv下载文件,Downloads \ venv \ Scripts,并且正在尝试激活我的虚拟环境venv。我试过了
venv activate
Run Code Online (Sandbox Code Playgroud)
由于Windows无法将venv识别为命令,因此无法使用。我也尝试过
virtualenv venv activate
Run Code Online (Sandbox Code Playgroud)
这也行不通,因为virtualenv表示“ venv activate”不是有效的参数。
小智 22
使用activate虚拟环境的 Scripts 目录中的脚本:
> venv\Scripts\activate
Run Code Online (Sandbox Code Playgroud)
这将激活您的虚拟环境,您的终端将根据您所在的目录如下所示:
(venv) C:\Users\acer\Desktop>
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助!
如果您使用virtualenvwrapper-win,并且使用DOS命令提示符(而不是Powershell),则使用以下命令创建新的virtualenv:
mkvirtualenv myenv
Run Code Online (Sandbox Code Playgroud)
并使用激活
workon myenv
Run Code Online (Sandbox Code Playgroud)
您应该定义环境变量,WORKON_HOME以指向您希望虚拟环境驻留的位置。
如果已安装,virtualenvwrapper-win>=1.2.4则该virtualenvwrapper命令将为您提供可用命令列表:
go|c:\srv> virtualenvwrapper
virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv
tool. The extensions include wrappers for creating and deleting
virtual environments and otherwise managing your development workflow,
making it easier to work on more than one project at a time without
introducing conflicts in their dependencies.
virtualenvwrapper-win is a port of Dough Hellman's virtualenvwrapper to Windows
batch scripts.
Commands available:
add2virtualenv: add directory to the import path
cdproject: change directory to the active project
cdsitepackages: change to the site-packages directory
cdvirtualenv: change to the $VIRTUAL_ENV directory
lssitepackages: list contents of the site-packages directory
lsvirtualenv: list virtualenvs
mkproject: create a new project directory and its associated virtualenv
mkvirtualenv: Create a new virtualenv in $WORKON_HOME
rmvirtualenv: Remove a virtualenv
setprojectdir: associate a project directory with a virtualenv
toggleglobalsitepackages: turn access to global site-packages on/off
virtualenvwrapper: show this help message
whereis: return full path to executable on path.
workon: list or change working virtualenvs
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11710 次 |
| 最近记录: |