Issue
I recently started to do some tutorials with python, I learned how to use venv and virtualenv but found them a little too complicated, since my developer background is basically javascript when I found pipenv I started using it. So far so good.
My question here is about the pipfile that pipenv generates when I run pipenv shell
in a specific folder, I'm currently learning how to build an API with Flask, the virtual environment works just fine, and everything I install in there works fine as well but the pipfile doesn't seem to be updating with the packages I'm installing, but when I check the dependency tree with pipenv graph
it shows all the dependencies I've been using, so is there something I'm missing with how pipenv works, or should it work this way?
Note: Whenever I want to create a new env i follow these steps:
mkdir app
cd app
pipenv shell
pip install somepackage
touch main.py
(add my code)python main.py
Solution
You have to install packages using the command pipenv install [package]
in order for pipenv
to create/update the Pipfile
and Pipfile.lock
files.
As you already installed the dependencies with pip
, you can run pipenv run pip freeze > requirements.txt && pipenv install -r requirements.txt
and it will create or update the aforementioned files for you. It is best, though, that you declare each package you want because this method also writes each package dependencies on these files.
Answered By - Maicon Mauricio
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.