Join my Asyncio(Python) course on Udemy 👀

Solving `command not found: pipenv`

April 14, 2021  ‐ 1 min read

It may that you installed pipenv and when you try to run it you see a message saying something like: command not found: pipenv.

Most likely you installed pipenv with pip(pip install pipenv) without having the directory where pip installs local dependencies in your PATH. PATH is a shell variable that defines the folders where your shell environment looks for commands. In Linux pip probably installs the pipenv command in ~/.local/bin.

One way around this that would probably work is to run pip install pipenv with sudo. However, if you do so for all packages you run arbitrary python code with superuser rights. With pipenv I am kinda assuming this is safeish. But you are better off solving this issue for good by adding ~/.local/bin to your PATH.

The file where you need to update your PATH depends on whether you use Bash, ZSH or anything else as a shell.

For bash open the file ~/.bashrc and add the following:

export PATH="$HOME/.local/bin:$PATH"

For Zsh open the file ~/.zshrc and add the following:

path+=("$HOME/.local/bin")
export PATH