I am about to start learning Flask, and I’ve followed the installation instructions at http://flask.pocoo.org/docs/installation/#installation.
I’ve followed the virtualenv method, as opposed to the system wide installation. I just don’t understand what the structure of virtualenv and how it relates to Flask.
I ran all the commands in a directory. Does this mean that virtualenv, Flask and Jinga2 are all running in that very directory only? Does that mean I will need to set up virtualenv and flask every time I start a flask project in that project’s directory?
Secondly, When I navigate outside of the directory, my prompt still has venv. How can I stop that?
Virtualenv creates an isolated environment where you can install python packages without installing them globally on the system. After you run
venv/bin/activateany new installed package is then inside this virtualenv (i.e. myproject/venv/lib) and if you exit the virtualenv then the system-wide python would not recognize the packages installed in virtualenv.It doesn’t matter where you install packages using
pip. When you executedvirtualenv venva folder called venv is created and all the installed packages will be copied there.Finally, in order to exit the virtual environment simply run
deactivate.