-
Notifications
You must be signed in to change notification settings - Fork 98
Using Pip
We must use pip and virtualenv separately. Always remember to use the same virtual environement!!!! This is a good practice for any python development.
Then, install virtualenv, create and activate the environment called venv:
$ pip3 install virtualenv
$ virtualenv -p python3 venv
$ source venv/bin/activate
You will then have a (venv)
before the $
, meaning that you are now in your virtual environment. Then, install the python package dependencies, which include Flask.
(venv)$ pip install -r requirements.txt
(venv)$ pip install -r requirements-dev.txt
To deactivate when you're using it:
(venv)$ deactivate venv
If you are using pip, your command line will have (venv)$
in front. Now look above for instructions to run the server.
I recommend using virtualenvwrapper to manage your virtual environments. To set virtualenvwrapper up:
$ pip3 install virtualenvwrapper
Then, copy this over to your .bashrc
or .bash_profile
so that the following commands would be run whenever your shell starts.
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
virtualenvwrapper should be all set up now with python3
To start a virtual environment named venv
:
$ mkvirtualenv venv
To exit:
(venv) $ exit
To activate an existing virtual environment named venv
:
$ workon venv
For more commands, visit here