当前位置: 代码迷 >> 综合 >> python虚拟环境virtualenv,virtualenvwrapper-win安装与使用
  详细解决方案

python虚拟环境virtualenv,virtualenvwrapper-win安装与使用

热度:41   发布时间:2024-01-25 02:58:27.0

1 virtualenv

1.1 virtualenv安装

pip install virtualenv

1.2 virtualenv基础命令

//创建虚拟环境testvir
C:\Users\Lenovo>virtualenv testvirUsing base prefix 'd:\\anaconda3'
New python executable in C:\Users\Lenovo\testvir\Scripts\python.exe
Installing setuptools, pip, wheel...
done.//激活testvir环境
C:\Users\Lenovo\testvir\Scripts>activate.bat
(testvir) C:\Users\Lenovo\testvir\Scripts>//退出虚拟环境
(testvir) C:\Users\Lenovo\testvir\Scripts>deactivate.bat
C:\Users\Lenovo\testvir\Scripts>

2 virtualenvwrapper-win

2.1 virtualenvwrapper-win安装

pip install virtualenvwrapper-win

2.2 virtualenvwrapper-win基本命令

//创建并进入testvir2虚拟环境
C:\Users\Lenovo\testvir\Scripts>mkvirtualenv testvir2C:\Users\Lenovo\Envs is not a directory, creating
Using base prefix 'd:\\anaconda3'
New python executable in C:\Users\Lenovo\Envs\testvir2\Scripts\python.exe
Installing setuptools, pip, wheel...
done.//退出虚拟环境
(testvir2) C:\Users\Lenovo\testvir\Scripts>deactivate//查看虚拟环境
C:\Users\Lenovo\testvir\Scripts>workonPass a name to activate one of the following virtualenvs:
==============================================================================
testvir2//进入testvir2虚拟环境
C:\Users\Lenovo\testvir\Scripts>workon testvir2(testvir2) C:\Users\Lenovo\testvir\Scripts>