程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] how to create a virtual environment (Windows)

編輯:Python

List of articles

  • One 、 How to be in python Create a virtual environment under the project :
    • 1、 Create a folder directly :(Windows)
    • 2、 Command line mode :
    • 3、 Activate to enter the virtual environment :
    • 4、 Installing plug-ins in a virtual environment :
    • 5、 Check the installed plug-in version number :
    • 6、 Exit virtual environment :
  • Two 、Mac And Linux Next :

One 、 How to be in python Create a virtual environment under the project :

There are two ways to create a virtual environment folder , For example, my virtual environment folder is python_ven_demo:

1、 Create a folder directly :(Windows)

First, create a new folder python_ven_demo,
Then go to the folder cd python_ven_demo,
Then build a virtual environment :python -m venv . ( notes :venv After that, add a little space “.”)

2、 Command line mode :

Create a virtual environment folder and virtual environment directly under the current directory :
Direct input python -m venv python_ven_demo ( Virtual environment folder name , Create a folder directly in the current directory , At the same time, the virtual environment is generated )

3、 Activate to enter the virtual environment :

need cd To Sripts Execute under directory activate Command to enter :

4、 Installing plug-ins in a virtual environment :

Be careful : Only after the virtual environment is activated - Only by installing plug-ins can they be isolated from the global environment, or the virtual environment will become a decoration

The virtual environment is now isolated from the global environment, and different plug-ins can be installed in different environments :

5、 Check the installed plug-in version number :

6、 Exit virtual environment :

Two 、Mac And Linux Next :

The steps are the same. The activation method needs to be in bin Under the table of contents : Use source activate Command to activate :


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved