Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python venv not creating virtual environment

I'm trying to create a virtual environment for my current Django project using

python3 -m venv env

however the command doesn't create any directory with bin/include/lib folders. What exactly am I missing here?

enter image description here

like image 844
Shury Avatar asked Sep 26 '19 13:09

Shury


People also ask

Do I need to activate VENV?

Activating the virtualenv gives you convenience. It is never required. Activating makes the PATH update stick until you deactivate again, and that can be convenient.


2 Answers

Sometime system's path environment is not aware of virtualenv.exe

solution:
install virtualenv

pip install virtualenv  

run command in the directory where you want virtual environment :

python3 -m virtualenv venv 
like image 103
Naveen Jain Avatar answered Oct 11 '22 04:10

Naveen Jain


I have a Windows 10 machine and had a same problem. It was because I had multiple versions of python. Unknowingly windows had created a python.exe in the WindowsApps folder -

enter image description here

Then the solution is sometimes:(there is a huge chance that, the old %PATH% got renamed)

py -m venv venv

This python.exe had a size of 0 kb, so I deleted the python.exe in the WindowsApps folder, opened a new Command prompt and it started working.

like image 22
hru_d Avatar answered Oct 11 '22 04:10

hru_d