WARNING: The script pip3.8 is installed in '/usr/local/bin' which is not on PATH

Question:

When running pip3.8 i get the following warning appearing in my terminal

WARNING: The script pip3.8 is installed in '/usr/local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.1.1 setuptools-56.0.0
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv

How to solve this problem on centos 7?

Asked By: Edward

||

Answers:

This question has been answered on the serverfaults forum: Here is a link to the question.

You need to add the following line to your ~/.bash_profile or ~/.bashrc file.

 export PATH="/usr/local/bin:$PATH"

You will then need to profile, do this by either running the command:

source ~/.bash_profile

Or by simply closing your terminal and opening a new session. You should continue to check your PATH to make sure it includes the path.

echo $PATH
Answered By: Matt Seymour

The other answers will work, but I found a more idiomatic way to do it on an AWS fresh install of Ubuntu 20.04.

That path statement is already there, but in .profile

You’ll need to log out, and log back in. Sourcing the environment won’t do it.

REASON:

In .profile, the code:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

will execute and automatically add .local/bin to your Path, when you log on.

If you install pip3 via sudo apt install python3-pip that directory JUST got created, and you haven’t logged out yet – and so that path statement hasn’t executed.

You could also execute .profile after doing the sudo apt install.

Answered By: J. Gwinner
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.