Overview:
Virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.
Purpose:
In this article, you will learn how to install venv & activate of python3 on Windows 10/11.
Target Audience:
For those whom want to create a virtual running environment of python without break system tools or other projects. This is optional if you don't care about the above benefit. The TA should have the basic knowledge of python, pip, venv and Windows command line under PowerShell.
Pre-requirement:
Please refer the follow link to install the python and pip if you never do it in your Windows 10/11.
How to install python3 and pip on Windows 10/11?
Procedures:
1. Create a brand new folder (For example: redfishtool) and change directory to that folder
PS C:\Users\[username]> mkdir redfishtool
PS C:\Users\[username]> cd redfishtool
PS C:\Users\[username]\redfishtool>
2. Create virtual envoirnment via venv
PS C:\Users\[username]\redfishtool> python -m venv .venv
3. Activate the venv created in step#2
PS C:\Users\[username]\redfishtool> .venv\Scripts\Activate.ps1
(.venv) PS C:\Users\[username]\redfishtool>
Note: If you get error like ExecutionPolicy, please run the following command in PowerShell then run the above command again
PS C:\Users\[username]\redfishtool> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
4. Deactivate the venv (You will see (.venv) was gone
(.venv) PS C:\Users\magv\redfishtool> deactivate
PS C:\Users\magv\redfishtool>
--- End of this article ---
Comments
0 comments
Please sign in to leave a comment.