Search code examples
pythonpython-3.xmakefilepippipenv

Install pipenv and project dependencies using a makefile


I want to create a make file using which I can automate the virtual environment creation and installation of project dependencies. I've create the following rule:

setup-env:
    sudo apt-get install python3 pip
    pip install pipenv
    pipenv shell
    pipenv install

I am able to install python, pipenv and create a virtual environment.

But the last line pipenv install is not getting execute because the control shifts to virtual environment. When I exit from the virtual environment, the install command gets executed.

Is there a way to install dependencies without creating a separate rule?

Thanks!


Solution

  • You can simple install before going into the shell (pipenv can be installed outside the shell)

    change the order of your rules:

    setup-env:
        sudo apt-get install python3 pip
        pip install pipenv
        pipenv install
        pipenv shell