English translation
To activate this environment, use
AI Article Decision Snapshot
Turn the lesson into workflow, model, budget, and security checks before choosing tools.
Use this quick snapshot before leaving the article. It keeps the next search tied to practical AI software, model/API, cost, privacy, and implementation questions.
Workflow fit
Identify the real job behind the article: coding, research, document review, support, analytics, content, or internal automation.
Model or tool decision
Decide whether the next step is a software shortlist, an AI tool comparison, an API platform choice, or a model benchmark.
Budget and usage signal
Estimate seats, API calls, prompt volume, retries, review time, and fallback work before assuming the workflow is cheap.
Security and privacy review
Check whether source code, customer data, private documents, prompts, logs, or embeddings will enter the AI workflow.
In the previous article, we discussed in detail how to use Anaconda to uninstall packages no longer needed, thereby keeping your environment clean and organized. In this article, we’ll learn how to create virtual environments and install required packages within them. Virtual environments allow you to independently manage dependencies for different projects on the same machine—preventing version conflicts between packages.
Creating a Virtual Environment
With Anaconda, you can quickly create a new virtual environment using the conda command. Here is the basic syntax:
conda create --name <env_name> [python=<version>]
Replace <env_name> with your desired environment name, and <version> with the Python version you wish to use in that environment (the default is the latest available version). For example, to create an environment named myenv using Python 3.8, run:
conda create --name myenv python=3.8
During environment creation, conda automatically resolves package dependencies and installs essential base packages. Upon successful creation, you’ll see output similar to the following:
Proceed ([y]/n)? y
# To activate this environment, use
#
# $ conda activate myenv
Activating the Virtual Environment
After creating the virtual environment, you must activate it to install and run packages within it. Use the following command to activate your environment:
conda activate myenv
Once activated, your command-line prompt will change to reflect the active environment—typically appearing as:
(myenv) user@hostname:~$
Installing Packages
Once your virtual environment is activated, you can use the conda install command to install required packages. The basic syntax is:
conda install <package_name>
For instance, to install numpy into the myenv environment, run:
conda install numpy
conda automatically handles dependencies and installs numpy along with all its required dependencies.
Example — Creating a Virtual Environment and Installing Multiple Packages
Let’s walk through a complete example to illustrate these steps. Suppose you’re developing a data analysis project requiring the following libraries:
numpypandasmatplotlib
Follow these steps to create the environment and install the libraries:
-
Create the environment:
conda create --name data_analysis python=3.9 -
Activate the environment:
conda activate data_analysis -
Install the required packages:
conda install numpy pandas matplotlib
After installation completes, verify the installed packages using:
conda list
This command displays all packages installed in the current virtual environment, along with their versions.
Summary
In this article, we learned how to use conda to create virtual environments and install necessary packages within them. This approach ensures each project operates in an isolated environment with its own set of dependencies—avoiding issues caused by incompatible package versions. In the next article, we’ll explore how to manage environment dependencies to ensure consistent, reproducible project execution.
Apply This Lesson
Turn this article into AI software, model, API, and security decisions.
English Article FAQ
Use this article as evidence before choosing AI tools
How should I use this AI Tutorials article?
Use it as the implementation or learning layer, then connect the idea to AI software buyer guides, tool comparisons, benchmarks, API choices, and security checks before making a production decision.
Is this English article different from the Chinese original?
The English edition is localized for global AI readers while preserving the original diagrams, screenshots, prompts, code examples, and source context from the Chinese article.
What should I read after To activate this environment, use?
Continue with AI Software Buyer Guides, AI Tools Workbench, Best AI Coding Agents, AI Model Benchmarks, OpenAI vs Anthropic API, or LLM Security Tools depending on the decision you need to make.
Can this article alone choose an AI product or model?
No. Treat the article as evidence and context, then validate fit with pricing, privacy requirements, integration effort, benchmark results, workflow tests, and fallback planning.
Continue