Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot properly create a virtual enviroment in Python 3.12

I use the command line

python3 -m venv .venv 

and a new .venv module is created but an error appears:

Error: Command '['/home/achu/Documentos/portfolio2023/.venv/bin/python3', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

the bin directory doesn't contain the activate file.

I've tried

$ apt install python3.12-dev python3.12-venv
like image 634
cloud Avatar asked Feb 02 '26 16:02

cloud


2 Answers

This worked for me:

sudo apt install python3.12-venv

and then

python3.12 -m venv new_venv

like image 105
Evangelos Con Avatar answered Feb 04 '26 06:02

Evangelos Con


Check if pip installed. Check if you using python3.12, and not other versions of python3.

curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.12 get-pip.py
like image 40
Brave Avatar answered Feb 04 '26 05:02

Brave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!