This article makes a speciality of Python programs location in numerous Linux distributions.
By studying this educational, you’re going to be informed the place the Python programs and modules are put in to your device and different Linux distributions. But crucial educating on this educational is within the remaining phase, the place you’re going to be informed how one can to find the Python programs with out memorizing the directories independently of the Linux distribution or set up approach.
All examples proven on this article come with screenshots, making it simple for each and every Linux consumer to grasp them independently in their wisdom stage.
Previous Necessary Step: Learning the Installed Python Version
To practice all directions described on this article, you should first know the Python model put in to your device.
To be informed it, you’ll be able to use the ls command adopted by way of the executable recordsdata trail and change the model with a wildcard as proven within the following:
As you’ll be able to see, there are two Python variations lately put in in my device: Python 3.9 and Python 2.7. The different paths belong to the symbolic hyperlinks.
Where Are Python Packages Stored When Installed Without Packages Manager
If the Python set up used to be completed from assets or from Python set up mechanisms (like easy_install or Python setup.py) and now not from a programs supervisor like apt-get or flair amongst others, Python programs are saved below the /usr/native/lib/python
This listing will also be outlined as common and legitimate for just about each and every Linux distribution as it’s according to set up strategies to be had for various distributions independently in their package deal managers. Of route, this isn’t legitimate when Python is put in the usage of a selected distro programs supervisor.
If you compiled Python from assets or put in it the usage of the setup.py or easy_install, you’ll be able to test this location the usage of the ls command as proven within the following screenshot the place 3.10 should get replaced together with your exact Python model.
Where Are Python Packages When Installed Through Pip
Python programs put in the usage of the pip command are saved below the /usr/native/lib/
You can to find the right kind location by way of the usage of the pip command adopted by way of the checklist choice as proven within the following:
Where Are Python Packages Installed in Debian/Ubuntu Distributions
If you’re a Debian, Ubuntu, or different based totally distribution and also you put in Python during the dpkg programs supervisor or certainly one of its frontends like apt-get, apt or flair, the programs are saved within the /usr/lib/python
Note: As discussed up to now, in the event you don’t set up Python the usage of the dpkg, apt, apt-get or flair, the programs may have a other location described within the first phase of this report.
Where Are Python Packages Installed in Red Hat Based Distributions & SUSE
Like in Debian/Ubuntu, Python programs with out outlined particular structure are put in below the /usr/lib/python
But particular structure Python programs in Red Hat are saved below a descriptive listing like /usr/lib64/python
Local Python programs are put in below /house/
How to Find Installed Python Packages Independently of the Installation Method
Whatever is your Linux distribution, you’ll be able to all the time use the to find command to look the recordsdata by way of form, on this case to search out the Python programs the usage of its .py extension as proven within the following determine the place /usr is the guardian listing within the recursive seek, -type f defines that you’re looking out recordsdata and now not directories, and “*.py” is the extension of recordsdata that you’re in search of.
to find /usr -type f -name “*.py”
Finding Python Modules
To to find the Python modules, open the Python console by way of executing the python
In our case, the usage of the Python 3, we execute the next code:
Then, we additionally execute this following code:
As you’ll be able to see, Python programs are put in in numerous places relying at the Linux distribution, set up strategies, and in some circumstances, relying at the structure. But the to find command comes in handy to look all Python programs independently of the set up approach, distribution, or structure, and is a sound method for each and every Linux distribution. Learning this system variations or how one can to find the recordsdata by way of form or extension is very simple and obligatory for the entire Linux customers independently in their wisdom stage. It is necessary to explain that whilst this newsletter supplies examples together with Python 2, this model used to be discontinued and Python 3 is the present model, with many enhancements. Always attempt to set up Python the usage of your Linux distribution programs supervisor, routinely resolving the dependencies and easing the removing procedure ahead of issues.
Thank you for studying this newsletter. We hope it used to be helpful. Keep following Linux Hint for extra skilled Linux guidelines and tutorials.