Skip to content

Instantly share code, notes, and snippets.

@c0m4r
Created February 6, 2026 15:33
Show Gist options
  • Select an option

  • Save c0m4r/e844dfbc93e5fce660e7bdaeedc710df to your computer and use it in GitHub Desktop.

Select an option

Save c0m4r/e844dfbc93e5fce660e7bdaeedc710df to your computer and use it in GitHub Desktop.
Create venv with specific version of Python

Create venv with specific version of Python

1. Create a new system user

useradd -m -d /home/example -s /bin/bash example
su - example

2. Install miniconda

https://www.anaconda.com/docs/getting-started/miniconda/install#linux-2

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

Do you wish to update your shell profile to automatically initialize conda?
(...)
Proceed with initialization? [yes|no]
[no] >>> yes

rm Miniconda3-latest-Linux-x86_64.sh

3. Log out and log in again

You should have "(base)" added to your PS1. There's a 1-2s lag while loading the venv.

4. Create a new venv with specific version of Python and activate it

conda create --name example python=3.11
conda activate example

That's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment