Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the python packages installed in docker

I'm using docker in my Mac.

Dockerfile:

#Dockerfile,Image,Container
FROM python:3.8

ADD main.py .

ADD test.py .

ADD spy511282022.csv .

RUN pip install requests pandas sqlalchemy

RUN pip list

CMD ["python","./test.py"]

My question is where are the packages sqlalchemy and requests located ,where are the directory ,because I want to modify some code of these package ,so I want to know where they have been installed.

Another question is ,can I customize the installation path and directory ?

like image 309
William Avatar asked Mar 08 '26 22:03

William


1 Answers

Packages are installed in /usr/local/lib/<python version>/site-packages/<package name>/.

for example, the requests package for python 3.12 is located in:

/usr/local/lib/python3.12/site-packages/requests/

You can also run pip show requests from within your docker container which should return the package location.

like image 62
Felix Scheffer Avatar answered Mar 10 '26 11:03

Felix Scheffer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!