Skip to content

Commit ec2a79e

Browse files
committed
vitrual env
1 parent be71350 commit ec2a79e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

23_Day_Virtual_environment/23_virtual_environment.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
<sub>Author:
1111
<a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
12-
<small> First Edition: Nov 22 - Dec 22, 2019</small>
12+
<small> Second Edition: July, 2021</small>
1313
</sub>
14-
15-
</div>
1614
</div>
1715

1816
[<< Day 22](../22_Day_Web_scraping/22_web_scraping.md) | [Day 24 >>](../24_Day_Statistics/24_statistics.md)
@@ -30,9 +28,11 @@
3028
To start with project, it would be better to have a virtual environment. Virtual environment can help us to create an isolated or separate environment. This will help us to avoid conflicts in dependencies across projects. If you write pip freeze on your terminal you will see all the installed packages on your computer. If we use virtualenv, we will access only packages which are specific for that project. Open your terminal and install virtualenv
3129

3230
```sh
33-
asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project$ pip install virtualenv
31+
asabeneh@Asabeneh:~$ pip install virtualenv
3432
```
3533

34+
Inside the 30DaysOfPython folder create a flask_project folder.
35+
3636
After installing the virtualenv package go to your project folder and create a virtual env by writing:
3737

3838
For Mac/Linux:
@@ -43,27 +43,33 @@ asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project\$ virtualenv venv
4343

4444
For Windows:
4545
```sh
46-
C:\Users\User\Documents\30DaysOfPython\flask_project>python3 -m venv venv
46+
C:\Users\User\Documents\30DaysOfPython\flask_project>python -m venv venv
4747
```
4848

49-
I prefer to call the new project venv, but feel free to name it differently. Let's check if the the venv was created by using ls (or dir for windows command prompt) command.
49+
I prefer to call the new project venv, but feel free to name it differently. Let us check if the the venv was created by using ls (or dir for windows command prompt) command.
5050

5151
```sh
5252
asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project$ ls
5353
venv/
5454
```
5555

56-
Let's activate the virtual environment by writing the following command at our project folder.
56+
Let us activate the virtual environment by writing the following command at our project folder.
5757

5858
For Mac/Linux:
5959
```sh
6060
asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project$ source venv/bin/activate
6161
```
62-
For Windows:
62+
Activation of the virtual environment in Windows may very on Windows Power shell and git bash.
63+
64+
For Windows Power Shell:
6365
```sh
6466
C:\Users\User\Documents\30DaysOfPython\flask_project> venv\Scripts\activate
6567
```
6668

69+
For Windows Git bash:
70+
```sh
71+
C:\Users\User\Documents\30DaysOfPython\flask_project> venv\Scripts\. activate
72+
```
6773

6874
After you write the activation command, your project directory will start with venv. See the example below.
6975

@@ -73,13 +79,13 @@ After you write the activation command, your project directory will start with v
7379

7480
Now, lets check the available packages in this project by writing pip freeze. You will not see any packages.
7581

76-
We are going to do a small flask project so let's install flask to this project.
82+
We are going to do a small flask project so let us install flask package to this project.
7783

7884
```sh
7985
(venv) asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project$ pip install Flask
8086
```
8187

82-
Now, let's write pip freeze to see a list of installed packages in the project:
88+
Now, let us write pip freeze to see a list of installed packages in the project:
8389

8490
```sh
8591
(venv) asabeneh@Asabeneh:~/Desktop/30DaysOfPython/flask_project$ pip freeze
@@ -104,4 +110,5 @@ The necessary modules to work with flask are installed. Now, your project direct
104110
1. Create a project directory with a virtual environment based on the example given above.
105111

106112
🎉 CONGRATULATIONS ! 🎉
113+
107114
[<< Day 22](../22_Day_Web_scraping/22_web_scraping.md) | [Day 24 >>](../24_Day_Statistics/24_statistics.md)

0 commit comments

Comments
 (0)