Virtual Environment with Python

Hi, I read a lot about virtual environments, but it seems I don’t understand anything.

So, I have my way as follows:

../my_app/
../my_app/app.py
..etc

Where should I host the virtual environment? Inside my_apphow /my_app/venv/bin,include,lib? or at the same level as my_app

/my_app/
/venv/

I don’t understand if the value takes place, or if with the help of activateit it refers to it instead of switching to the main environment.

I hope this question makes sense.

Thank!

+4
source share
2 answers

, virtualenv . , . , , ~/school. cd ~/school, do virtualenv ENV. ENV, . , ~/school/ENV/source, . , ENV.

EDIT:

: , source bin/activate Python pip, .

+3

, , .

, , , ( ). .

, . script , .

:

$ virtualenv /home/somedir/envs/myenv
... # some output
$ source /home/somedir/envs/myenv/bin/activate
(myenv) $ mkdir /home/somedir/projects
(myenv) $ cd /home/somedir/projects
(myenv) projects $ 

, envs myenv. /home/somedir/projects. deactivate, .

+2

Source: https://habr.com/ru/post/1546500/


All Articles