Fundamentals 4 min read

Managing Python Virtual Environments with Conda: Overview, Creation, Activation, and Package Installation

This article explains the purpose of Python virtual environments, illustrates common scenarios requiring separate environments, and provides step‑by‑step Conda commands for listing, creating, activating environments, and installing packages within them to ensure project isolation.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Managing Python Virtual Environments with Conda: Overview, Creation, Activation, and Package Installation

Today we discuss the value of Python virtual environments and the common commands used to manage them.

In real‑world projects, different applications often depend on different libraries or library versions (e.g., Scrapy, Beautiful Soup). Installing and uninstalling these packages directly in the global Python environment quickly becomes messy and error‑prone.

Typical scenarios include:

Project A requires library version 1.0 while Project B needs version 2.0; without isolated environments you would have to constantly uninstall and reinstall packages, leading to conflicts.

An older project runs on Python 2.7, whereas a new project requires Python 3.x; without virtual environments the two cannot coexist on the same system.

Understanding the basic commands for virtual environment management is therefore essential.

Viewing Existing Virtual Environments

# Run the following command in the terminal
conda info --envs

Creating a New Virtual Environment

# Run the following command in the terminal
conda create --name newName python=3.7

After creating multiple environments and installing different third‑party packages in each, switching between environments becomes important.

Switching Virtual Environments

# Switch to the desired environment (example: project-1)
conda activate project-1

Once the environment is active, you can install packages within it:

# Install ipykernel in the current environment
conda install ipykernel
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Developmentvirtual environmentCondapackage-management
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.