Question
Answer and Explanation
The presence of Python 3.6 without python-devel
usually boils down to the different purposes these packages serve. Here’s a breakdown:
1. Python 3.6 (or similar):
- This package represents the core runtime environment for Python. It includes the Python interpreter and standard library modules needed to run Python scripts and applications. When someone installs Python, they are typically looking to execute existing Python code or use Python as a high-level programming tool. The package provides what's needed to run Python application, but it doesn't give tools for extending Python functionality by compiling any Python extensions. It means that it contains the necessary elements for interpreting and executing Python code.
2. Python-devel (or python3-dev):
- This package is a developer-centric package, providing header files and libraries required for compiling Python extensions written in C or C++. It's not needed to simply run Python code. This package is necessary if you intend to build and install libraries that include compiled C code, especially common with modules that provide performance or interface to specific hardware or system-level libraries. For example, if your Python project uses modules like NumPy or SciPy which have C components to provide speed, then python-devel
or python3-dev
is a must.
3. Why the Discrepancy?
- Different Use Cases: Not all users of Python require the development tools. Most users simply need the Python interpreter to run Python scripts. The python-devel
package is generally only needed for advanced use cases, such as creating extensions or compiling software that uses the Python API.
- Installation Size and Dependencies: The python-devel
package typically introduces additional dependencies and increases the install size. Therefore, it might be excluded from basic or minimal Python installations to conserve resources, unless specified by the user.
- Separate Package Management: Systems and distributions often separate the core Python runtime environment from its development utilities to better manage dependencies. This way, it's clear what each specific package is meant to do. For example, a server that only serves Python applications might not need python-devel
. However, a development machine would typically require python-devel
.
4. How to Install Python-devel:
- Usually, on Linux distributions, you can use your distribution’s package manager to install python-devel
. For example, on Debian/Ubuntu systems, you would use:
sudo apt install python3-dev
- For Red Hat-based systems such as CentOS or Fedora, you would use:
sudo yum install python3-devel
In summary, if you only need to run Python scripts, installing the core Python package (like Python 3.6) is enough. If you plan to develop Python extensions that interface with C/C++ libraries or compile software with Python bindings, then you must install the corresponding python-devel
package. The absence of python-devel
by default aligns with most standard Python installations which focus on running, rather than developing Python applications.