python virtual environment configuration and management

P粉469731340
Release: 2022-07-15 15:28:32
Original
1315 people have browsed it

1. Download and install python

1. Download python

python virtual environment configuration and management

##2. python installation

  • Choose custom installation

  • Check to add python to the system environment variables

  • At the same time, pip and IDLE interactive tools are installed

   

python virtual environment configuration and management

python virtual environment configuration and managementpython virtual environment configuration and management

4. Verify python and pip

  • Enter the python command under the cmd command to view python version

  • C:\Users>python
    Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>exit()
    Copy after login
  • Enter pip list under the cmd command and the following command to view pip

    (to return to the drive letter directory)

  • C:\Users>pip list
    Package    Version
    ---------- -------
    pip        20.2.3
    setuptools 49.2.1
    Copy after login
2. Install the virtual environment

  1. Download and install the virtual environment

  2. C:\Users>pip install virtualenv
    Copy after login

python virtual environment configuration and management

2. Download virtualenvwrapper management environment

  • virtualenvwrapper 是一个 virtualenv 虚拟环境的管理库,这个库可以更加方便的管理所有的虚拟环境

C:\Users***>pip install virtualenvwrapper-win
Copy after login
  • 更改virtualenvwrapper虚拟环境目录,后面创建的虚拟环境都存储在此目录下

    • 在环境变量中新建WORKON_HOME,值为目录。之后创建的虚拟环境将会自动存储在该目录下

python virtual environment configuration and management

3. 虚拟环境的使用

  • 创建虚拟环境

    mkvirtualenv 名称
    Copy after login
  • 激活或切换虚拟环境

    workon my_env
    Copy after login
  • 退出虚拟环境

    deactivate
    Copy after login
  • 删除虚拟环境

    rmvirtualenv 名称
    Copy after login
  • 查看系统所有的虚拟环境

    lsvirtualenv
    Copy after login

推荐:《Python视频教程

The above is the detailed content of python virtual environment configuration and management. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!