Conda Environment Setup Guide
This guide helps you set up and use a Conda environment named myenv3.12
with Python 3.12.
1. Install Miniconda
Download the Miniconda installer for your platform from:
https://docs.conda.io/en/latest/miniconda.html
Install via Terminal (macOS, Apple Silicon example):
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash Miniconda3-latest-MacOSX-arm64.sh
Follow the prompts and restart your terminal after installation.
source ~/.zshrc
2. Create a New Environment
Create an environment named myenv3.12
with Python 3.12:
conda create -n myenv3.12 python=3.12
3. Activate the Environment
conda activate myenv3.12
4. Install Packages
Example: Install numpy and pandas
conda install numpy pandas
5. List Your Environments
conda env list
6. Deactivate the Environment
conda deactivate
7. Remove the Environment (if needed)
conda env remove -n myenv3.12
8. Useful Tips
- Always activate your environment before working on your project.
- Install packages only after activating the desired environment.
- To update conda itself:
conda update conda
9. List out packages in a specific environment
conda activate myenv3.12
conda list
10. Using Conda Environment in PyCharm
- In PyCharm, go to Preferences > Project > Python Interpreter.
- Click Add Interpreter > Conda Environment > Existing environment.
- Browse to:
~/miniconda3/envs/myenv3.12/bin/python
- Click OK to set it as your project interpreter.
11. Create or Update the current environment with an environment.yml file
name: myenv3.12
dependencies:
- python=3.12
- pandas
- numpy
- matplotlib
- seaborn
- scikit-learn
- tensorflow
conda env create -f backend/environment.yml
conda env update --file environment.yml --prune
Happy coding anvo0000!
Top comments (0)