How to create a virtual environment using virtualenv under Windows (two ways)

How to create a virtual environment using virtualenv under Windows (two ways)

Operating system: windowns10_x64

Python version: 3.6.8
virtualenv version: 16.7.7
virtualenvwrapper version: 1.2.5

Method 1: Use virtualenv directly

1. Installation

pip install virtualenv

2. Create a virtual environment

virtualenv -pd:/app/Python36/python.exe py36env

3. Start the virtual environment

py36env\Scripts\activate.bat

4. Exit the virtual environment

deactivate

If you need to delete the virtual environment, just delete py36env.

Method 2: Using virtualenvwrapper

1. Installation

pip install virtualenvwrapper-win

2. Set the environment variable WORKON_HOME to specify the default path of the virtualenvwrapper virtual environment

For example, set it to c:\venv and create the venv directory.

If not set, the relevant folders will be automatically created in the current user directory.

3. Create a virtual environment

mkvirtualenv py36env -pd:/app/Python36/python.exe

4. View all virtual environments and start virtual environments

lsvirtualenv

workon py36env

5. Exit the virtual environment

deactivate

If you need to delete the virtual environment, execute the following command:

rmvirtualenv py36env

This article's github address:

https://github.com/mike-zhang/mikeBlogEssays/blob/master/2019/20191026_Use virtualenv under windows.rst

Summarize

The above is the way I introduced to you to use virtualenv to create a virtual environment under Windows. I hope it will be helpful to you!

You may also be interested in:
  • Detailed installation and use of Python virtual environment virtualenv under Windows
  • Install Python virtual environment virtualenvwrapper-win under Windows
  • Python virtual environment virtualenv usage tutorial
  • Installation and use of Python virtual environment virtualenv
  • Detailed installation and use of Python virtual environment virtualenv
  • How to install Python virtual environment virtualenv on Linux
  • Python Virtual Environment Virtualenv Usage Tutorial

<<:  How to store text and pictures in MySQL

>>:  How to preview pdf file using pdfjs in vue

Recommend

Solve the problem of garbled Chinese characters in Mysql5.7

When using MySQL 5.7, you will find that garbled ...

In-depth analysis of the Tomcat server of Centos 7 system

Table of contents 1. The origin of tomcat 1. Tomc...

Server stress testing concepts and methods (TPS/concurrency)

Table of contents 1 Indicators in stress testing ...

Pros and Cons of Vite and Vue CLI

There is a new build tool in the Vue ecosystem ca...

A detailed discussion of components in Vue

Table of contents 1. Component Registration 2. Us...

K3s Getting Started Guide - Detailed Tutorial on Running K3s in Docker

What is k3d? k3d is a small program for running a...

Use CSS to implement special logos or graphics

1. Introduction Since pictures take up a lot of s...

How to build ssh service based on golang image in docker

The following is the code for building an ssh ser...

Summary of the dockerfile-maven-plugin usage guide

Table of contents pom configuration Setting.xml c...

Native JS to achieve book flipping effects

This article shares with you a book flipping effe...

Simple writing of MYSQL stored procedures and functions

What is a stored procedure Simply put, it is a se...

HTML Code Writing Guide

Common Convention Tags Self-closing tags, no need...

Solution to the conflict between nginx and backend port

question: When developing the Alice management sy...

Detailed Tutorial on Using xargs Command on Linux

Hello everyone, I am Liang Xu. When using Linux, ...