Creating Python Virtual Environment: How-to

Hi all,

In this posting, I'm going to show how we can create a Python virtual environment using Windows Command Prompt (CMD).

Here's the plan. I'm going to create a new folder named upwork where I will store all documents and source codes from Upwork projects. In this upwork folder, I will create a new python virtual environment named vupwork. I'm using Windows Command Prompt but I'm sure there will be more similar tutorials for you, non-windows users. Let's dive in!


1. Create your first virtual environment. The command would be in the following form:

python[python_version] -m venv [your_venv_name]


2. Now, activate the newly created virtual environment using the following command:
[your_venv_name]\Scripts\activate


3. Now, as your virtual environment is already activated, you may want to install some packages using pip. Let's try to add pandas!
        pip install [packages_to_be_installed]


4. Last thing: deactivate your virtual environment using the deactivate command


That's it. Enjoy!

Comments

Popular posts from this blog

Adding a Dashed Connector in Draw.io

DBeaver / PostgreSQL: "Error: database already exists" Workaround

How to Get The Replication Factor of HDFS Files