Configuring python virtual environment (win10)

A, virtualenv configuration python virtual environment

I want to name my D drive called the next [python_virtualenv] directory under [python virtual environment] create a directory named [gupan_test] virtual environment

1.win + r to open the cmd window
command d: D into the root directory
2. mkdir python virtual environment to create the directory
3. cd python virtual environment;
4. mkdir python_virtualenv
5. use pip tool installation virtualenv virtualenv install packages pip
6. create a name for the new environment using the command virtualenv directory gupan_test, whose name I have here gupan_test just played
    virtualenv --no-site-packages gupan_test


step by step to complete is:
d: d into the disk
mkdir python virtual environment to create a virtual environment [python] folder
cd python virtual environment into the virtual environment [python] folder
mkdir python_virtualenv create [ python_virtualenv] folder
cd python_virtualenv] folder into the [python_virtualenv
pip install virtualenv installation virtualenv plug (slow speed of the source can be specified pip, pip install -i https://pypi.douban.com/simple/ virtualenv)
virtualenv --no-Site-Packages Standard Package gupan_test create a name using the command virtualenv the new environment directory gupan_test
activate and you'll get you a directory to the directory named gupan_test into the Scripts directory, execute the activate command to activate the virtual space
at this time entered the python virtual environment

 

 

 

 

二、virtualenvwrapper

By virtualenvthe time to create a virtual environment, whether it is created or activated when they have to cd to a specific directory down, looked so inconvenient. Virtualenvwrapper can be used to manage the virtual environment.

 

Installation virtualenvwrapper:

1. pip install virtualenvwarepper 或 pip3 install virtualenvwrapper 或  pip install -i https://pypi.douban.com/simple/ virtualenvwraper-win

2. Configure environment variables: If you do not configure the environment variables, virtual environment the user is created in the current directory, configuration directory after in your variable values ​​(re-open the cmd command line configuration End)

3. Create a virtual environment:

mkvirtualenv [--python == C: \ Python36 \ python.exe] virtual environment name
# --python can specify a particular python interpreter, optional

 

 

 

virtuaenvwrapper基本使用

1.创建虚拟环境:

    mkvirtualenv [--python==C:\Python36\python.exe] 虚拟环境名
     
    # --python 可以指定具体的python解释器,可选

2.激活虚拟环境:

workon my_env    进入虚拟空间后的  pip list 查看本虚拟空间的插件

3.退出当前虚拟环境:

 deactivate

4.列出所有虚拟环境:

lsvirtualenv

5.删除虚拟环境

 rmvirtualenv my_env

6.进入虚拟环境所在目录:

cdvirtualenv

 

Guess you like

Origin www.cnblogs.com/gupanpan/p/12310494.html
Recommended