I installed python 3 and pip
into in Windows System for Linux shell, but it appears I have to find and specify site-packages
directory manually if I want to run any python package executables. The packages I wanted to use were cheat and awscli, but the problem is the same for any package.
My chain of commands was:
- install WSL - Ubuntu 18.04
sudo apt-get update
(becausesudo apt-get install pip3
will not work on fresh installation)sudo apt-get install pip3
(installs python too)sudo pip3 install cheat
cheat
not recognised as a command, whilepython3
runs fine from/usr/bin/python3
- realise
$HOME/.local/lib/python3.6/site-packages
must be on path - in
~/.profile
add$HOME/.local/lib/python3.6/site-packages
to path withexport PATH="$HOME/.local/lib/python3.6/site-packages:PATH"
- restart
~/.profile
I there something I can change in the installation process so that I mustn't search for site-packages
directory and add it to path manually?
UPDATE: proper call executed for pip was sudo pip3 install cheat
. there is no plain pip
on the system. calling pip
results in error Command 'pip' not found.
sudo pip install
. By that, you save yourself a lot of future errors. Usepip install --user
instead. Do it right now: got throughpip3 list
output, try to find packages you already installed (plus their dependencies), uninstall and reinstall them as user. By doing that, you will immediately notice the commands to become available because of thePATH
changes you made.sudo pip install
ing, adjust thePATH
correctly: check out the output ofpip3 show cheat | grep Location
, two segments up and descend intobin
and add that directory toPATH
.PATH
; suggested a fix in the answer.