Skip to content

Using Pip

Timothy Ko edited this page May 20, 2018 · 5 revisions

Using Pip

Using pip would require a little bit more steps, since you would have to use pip and virtualenv separately. In addition, managing requirements.txt can be a pain. For more benefits pipenv solves, look at their documentation. I'd recommend using Pipenv but if you still haven't changed your mind, here are the instructions. If you do decide to change, stick to pip and you may delete Pipfile and Pipfile.lock.

Always remember to use the same virtual environement!!!! This is a good practice for any python development.
First, you must generate a requirements.txt file listing all the dependencies:

$ pipenv lock -r > requirements.txt

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

To deactivate when you're using it:

(venv)$ deactivate venv

If you are using pip, your command line will have (venv)$ in front instead of the (flask......) bash-3.2$ Now look above for instructions to run the server.