Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create and activate virtual environment in windows 10 using bash command

I am trying to activate my virtual environment using bash command in windows 10. I am using python 3.5.1 . F:\Python\Python35 is the location where my python.exe is located. My virtual environment's name is myvenv and F:\Python\virtualenvironment\myvenv is the location where my virtual environment is located. I created my virtual environment using following bash command

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment 
$ python -m venv myvenv

But i can't activate it now. I used

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment
$ source myvenv/Scripts/activate 

and

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment/myvenv 
$ source Scripts/activate

But nothing works. It gives me error like
bash: Scripts/activate: No such file or directory

Can anyone say how can i activate my virtual environment using bash command?

like image 578
Nazem Mahmud Piash Avatar asked Apr 16 '17 19:04

Nazem Mahmud Piash


1 Answers

I have solved it.

At first, I install virtualenv using following command:

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment
$ pip install virtualenv

Then I create a new virtual environment using this command:

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment
$ py -m virtualenv env

Here, env is my virtual environment name. Next, to activate this virtual environment I ran following command:

Nazem Mahmud@DESKTOP-VQR06GL MINGW64 /f/Python/virtualenvironment
$ source env/Scripts/activate
like image 167
Nazem Mahmud Piash Avatar answered Sep 17 '22 22:09

Nazem Mahmud Piash