seanspotatobusiness
Posts: 221
Joined: Tue May 22, 2012 11:19 pm

Where are python libraries installed to?

Mon May 14, 2018 10:55 pm

When I use pip to install python libraries, where in the folder hierarchy do they go?
Raspberry Pi 3 B and B+
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"

User avatar
Paeryn
Posts: 3594
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Where are python libraries installed to?

Tue May 15, 2018 1:57 am

seanspotatobusiness wrote:
Mon May 14, 2018 10:55 pm
When I use pip to install python libraries, where in the folder hierarchy do they go?
For a single user (i.e. not using sudo), usually in

Code: Select all

~/.local/lib/python2.7
For system-wide (i.e. using sudo pip) then usually in

Code: Select all

/usr/local/lib/python2.7
And for Python packages installed by apt then they usually go in

Code: Select all

/usr/lib/python2.7
Normally Python then uses the sub-directory site-packages but Debian based installs (of which Raspbian is) use the sub-directory dist-packages.

So if you do

Code: Select all

sudo pip install mylib
then mylib should end up in

Code: Select all

/usr/local/lib/python2.7/dist-packages
For pip3 then substitute python2.7 with python3.5
Kira the Koding Kitty, R.I.P. 8/3/24

seanspotatobusiness
Posts: 221
Joined: Tue May 22, 2012 11:19 pm

Re: Where are python libraries installed to?

Tue May 15, 2018 8:57 am

Perfect. Thanks very much!
Raspberry Pi 3 B and B+
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"

scotty101
Posts: 4531
Joined: Fri Jun 08, 2012 6:03 pm

Re: Where are python libraries installed to?

Tue May 15, 2018 3:17 pm

A recent XKCD explains the python environment 'spaghetti' quite well

https://m.xkcd.com/1987/
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Where are python libraries installed to?

Tue May 15, 2018 3:27 pm

scotty101 wrote:
Tue May 15, 2018 3:17 pm
A recent XKCD explains the python environment 'spaghetti' quite well

https://m.xkcd.com/1987/
Excellent!

There's a lot to be said for the concept that when you create a new language, you should name it something different from previous (ancestral) languages.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

Return to “Python”