Getting to the Python autistic - The virtual environment under the windows installation commands

Virtual environment virtualenv

If on one computer, want to develop a number of different projects, the need to use different versions of the same package, if you use the above commands to install or update in the same directory, the new version overwrites the previous version, others the project will not be able to run. the companies which tend presence of multiple projects, so it is necessary to use a virtual environment, the need to use the current version of the project and its isolation module packaging to use a virtual environment.

1 Installation

pip install virtualenv -i https://pipy.douban.com/simple     
pip install virtualenv-clone -i https://pipy.douban.com/simple
pip install virtualenvwrapper -i https://pipy.douban.com/simple
pip install virtualenvwrapper-win -i https://pipy.douban.com/simple

# 注意以上命令适用于window系统

2 commonly used commands

创建虚拟环境:                mkvirtualenv 虚拟环境名称
创建虚拟环境(指定python版本): mkvirtualenv -p python 虚拟环境名称
查看所有虚拟环境:            workon+2次tab键
使用虚拟环境:               workon 虚拟环境名称
退出虚拟环境:               deactivate
删除虚拟环境(必须先退出虚拟环境内部才能删除当前虚拟环境):
                            rmvirtualenv 虚拟环境名称
    
其他相关命令:
查看虚拟环境中安装的包:              pip freeze  或者 pip list
收集当前环境中安装的包及其版本:       pip freeze > requirements.txt
在部署项目的服务器中安装项目使用的模块: pip install -r requirements.txt

prompt:

  • Only inside the virtual environment management environment and python parser module for the source code is nothing to

  • Create a virtual networking environment requires
  • Once created, it will automatically work on this virtual environment
  • Work in a virtual environment, the front will prompt "(virtual environment name)"

Guess you like

Origin www.cnblogs.com/heyulong1214/p/12047405.html
Recommended