pip
Python
command line
executable not found
package installation

pip installs packages successfully, but executables are not found from the command line

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

When pip installs a package successfully but the command is still “not found,” the package itself is usually fine. The real problem is almost always that the script was installed into a directory that your shell is not searching, or that the package was installed into a different Python environment than the one you are currently using.

Understand Where pip Puts Executables

Many Python packages install console entry points into a scripts directory associated with the target interpreter. The exact location depends on whether you installed globally, in a virtual environment, or with --user.

The first diagnostic step is to make sure pip belongs to the Python you think it belongs to:

bash
python -m pip --version
python -c "import sys; print(sys.executable)"

Using python -m pip is safer than calling bare pip because it removes much of the interpreter ambiguity.

Check the Scripts Directory

You can inspect where user-level scripts are expected to go with:

bash
python -m site --user-base

A package installed with pip install --user usually puts executables under a bin or Scripts directory inside that base path.

For example:

  • Linux and macOS often use a path ending in /bin.
  • Windows often uses a path ending in Scripts.

If that directory is not on your shell PATH, the command will not be found even though installation succeeded.

Virtual Environments Change the Answer

If the package was installed inside a virtual environment, its executable lives inside that environment’s scripts directory.

Typical workflow:

bash
1python -m venv .venv
2source .venv/bin/activate
3python -m pip install black
4black --version

If the environment is not activated, the shell may not see the right black executable.

On Windows PowerShell, activation usually looks like:

powershell
.\.venv\Scripts\Activate.ps1

Inspect the Installed Package

If the package installs but the command is missing, confirm that the package actually provides a console script. Not every Python package installs a command-line executable.

You can inspect package metadata with:

bash
python -m pip show package-name

If the package is a library only, there may be nothing to run from the shell.

Fix the PATH

If the executable exists but the shell cannot find it, add the relevant scripts directory to PATH.

Example for a Unix shell:

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

Example check:

bash
echo "$PATH"
which black

On Windows, the equivalent fix is usually adding the appropriate Scripts directory to the user or system Path environment variable.

Multiple Python Installations Cause Confusion

This issue is especially common on machines with several Python installations. A package may be installed by one interpreter while the shell command search path points to another interpreter’s script directory.

That is why these checks matter:

bash
which python
which pip
python -m pip --version

The paths should make sense together. If they do not, choose one interpreter path deliberately and use it consistently.

Common Pitfalls

The most common mistake is using bare pip instead of python -m pip, then installing into a different interpreter than the one expected.

Another issue is forgetting that a virtual environment must be activated before its scripts are on PATH.

People also assume every package installs a command-line tool. Some packages are libraries only, so there is no executable to discover.

Finally, adding a scripts directory to PATH solves only shell discovery. It does not fix interpreter mismatch if the package was installed into the wrong Python environment in the first place.

Summary

  • A successful pip install does not guarantee the shell can find the executable.
  • Use python -m pip to ensure you install into the intended interpreter.
  • Check whether the scripts directory is on PATH.
  • Activate virtual environments before expecting their commands to work.
  • Verify that the package actually provides a console script instead of only a library API.

Course illustration
Course illustration

All Rights Reserved.