Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible (and how) to see the Python source code for the package that is installed with 'pip install package-name'?

Tags:

python

pip

Is it possible (and how) to see the Python source code for the package that is installed with 'pip install package-name'? I have found wheels file, but it is in compiled format. Installation messages are also talking about building and installing, so, I guess, that only compiled code is available on my computer now?

like image 734
TomR Avatar asked Oct 28 '25 18:10

TomR


1 Answers

Run pip show --files package-name. See the full paths to the files. View *.py files.

There are some modules and packages written in C or C++ — you cannot see their sources after installation, you have to find out their source code. Start looking for package-name at PyPI.

wheels file … in compiled format

No, it's not. It's a zip archive. You can unzip it. Probably you can click or double-click on it in your file manager — most file managers recognize zip archives and show their content.

like image 124
phd Avatar answered Oct 31 '25 09:10

phd