nhjk
nhjk

Reputation: 7830

virtualenv not found in path

For some reason virtualenv is not in my path after installing with pip3. I have a fresh install of ubuntu 16.04.

sudo apt-get install pip3
pip3 install virtualenv
virtualenv # command not found!!!

edit: I also installed jupyter notebook with pip3 and its not in the path either.

Upvotes: 1

Views: 5109

Answers (2)

h2ku
h2ku

Reputation: 1009

This is Ubuntu only (didn't check other distros)

TL;DR (if you used pip to install pkg) run following command

$ source ~/.profile

If you examine .profile there is a script looks like following.
(18 version. 16 version has something different)

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

which means everything under ~/.local/bin will be added to PATH.
So, if you used pip to install pkg and try to run from prompt. As long as pip created file under the folder it will let you run commands without full path.
You can restart the session too. Whichever you feel comfortable with.

Upvotes: 2

nhjk
nhjk

Reputation: 7830

Python executables are placed in ~/.local/bin/ on Ubuntu 16.04. This location is not in $PATH so edit your .bashrc to append it there.

# .bashrc file
export PATH=$PATH:~/.local/bin

Upvotes: 3

Related Questions