Creating venv inPython:

Shankar Pentyala
1 min readApr 17, 2023

--

Here are the commands to create a Python virtual environment:

  1. Open your terminal or command prompt.
  2. Navigate to the directory where you want to create your virtual environment.
  3. Run the following command to create a new virtual environment:

For Windows:

python -m venv myenv

For Mac and Linux:

python3 -m venv myenv

Here, myenv is the name of your virtual environment. You can choose any name you like.

  1. Activate the virtual environment by running the following command:

For Windows:

myenv\Scripts\activate.bat

For Mac and Linux:

source myenv/bin/activate

You should see the name of your virtual environment appear in parentheses in your terminal prompt. This indicates that the virtual environment is active.

  1. Install any packages you need within the virtual environment using pip. For example:
pip install requests

This will install the requests package within your virtual environment.

  1. When you’re finished working in the virtual environment, you can deactivate it by running the following command:
deactivate

This will return your terminal prompt to its normal state and deactivate the virtual environment.

--

--

Shankar Pentyala

I am interested in writing cloud and devops related concepts , exploring LLMS