This guide explains how to create and activate a virtual environment for Python 3.9 or 3.11 using either Conda or Python's built-in venv module.
Run the following command to create a Conda environment with Python 3.9 or 3.11:
conda create --name <env_name> python=3.11Replace <env_name> with the name of your environment (e.g., `quantum_sim).
To activate the environment, use:
conda activate <env_name>To deactivate the environment, use:
conda deactivateRun the following command to create a virtual environment:
python -m venv <env_name>Replace <env_name> with the name of your virtual environment (e.g., venv).
- On Windows:
<env_name>\Scripts\activate
- On Linux/Mac:
source <env_name>/bin/activate
To deactivate the virtual environment, use:
deactivateAfter activating the environment, verify the Python version to ensure it matches your desired version (e.g., 3.9 or 3.11):
python --versionOnce the environment is activated, install the required dependencies using:
pip install -r requirements.txt- Always activate the environment before running your Python scripts.
- Use
pip freeze > requirements.txtto save the current environment's dependencies.
Let me know if you need further assistance!