Skip to content

Commit 97a689e

Browse files
Docs: Add tabs to Linux build dependencies (#1840)
1 parent e0ecbef commit 97a689e

1 file changed

Lines changed: 44 additions & 41 deletions

File tree

getting-started/setup-building.rst

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -768,64 +768,67 @@ some of CPython's modules (for example, ``zlib``).
768768
distribution, but the appropriate commands for some popular distributions
769769
are below.
770770

771-
On **Fedora**, **RHEL**, **CentOS** and other ``dnf``-based systems::
771+
.. tab:: dnf
772772

773-
$ sudo dnf install git pkg-config
774-
$ sudo dnf install dnf-plugins-core # install this to use 'dnf builddep'
775-
$ sudo dnf builddep python3
773+
On **Fedora**, **RHEL**, **CentOS** and other ``dnf``-based systems::
776774

777-
Some optional development dependencies are not included in the above.
778-
To install some additional dependencies for optional build and test components::
775+
$ sudo dnf install git pkg-config
776+
$ sudo dnf install dnf-plugins-core # install this to use 'dnf builddep'
777+
$ sudo dnf builddep python3
779778

780-
$ sudo dnf install \
781-
gcc gcc-c++ gdb lzma glibc-devel libstdc++-devel openssl-devel \
782-
readline-devel zlib-devel libzstd-devel libffi-devel bzip2-devel \
783-
xz-devel sqlite sqlite-devel sqlite-libs libuuid-devel gdbm-libs \
784-
perf expat expat-devel mpdecimal python3-pip
779+
Some optional development dependencies are not included in the above.
780+
To install some additional dependencies for optional build and test components::
785781

782+
$ sudo dnf install \
783+
gcc gcc-c++ gdb lzma glibc-devel libstdc++-devel openssl-devel \
784+
readline-devel zlib-devel libzstd-devel libffi-devel bzip2-devel \
785+
xz-devel sqlite sqlite-devel sqlite-libs libuuid-devel gdbm-libs \
786+
perf expat expat-devel mpdecimal python3-pip
786787

787-
On **Debian**, **Ubuntu**, and other ``apt``-based systems, try to get the
788-
dependencies for the Python you're working on by using the ``apt`` command.
788+
.. tab:: apt
789789

790-
First, make sure you have enabled the source packages in the sources list.
791-
You can do this by adding the location of the source packages, including
792-
URL, distribution name and component name, to ``/etc/apt/sources.list``.
793-
Take Ubuntu 22.04 LTS (Jammy Jellyfish) for example::
790+
On **Debian**, **Ubuntu**, and other ``apt``-based systems, try to get the
791+
dependencies for the Python you're working on by using the ``apt`` command.
794792

795-
$ deb-src http://archive.ubuntu.com/ubuntu/ jammy main
793+
First, make sure you have enabled the source packages in the sources list.
794+
You can do this by adding the location of the source packages, including
795+
URL, distribution name and component name, to ``/etc/apt/sources.list``.
796+
Take Ubuntu 22.04 LTS (Jammy Jellyfish) for example::
796797

797-
Alternatively, uncomment lines with ``deb-src`` using an editor, for
798-
example::
798+
$ deb-src http://archive.ubuntu.com/ubuntu/ jammy main
799799

800-
$ sudo nano /etc/apt/sources.list
800+
Alternatively, uncomment lines with ``deb-src`` using an editor, for
801+
example::
801802

802-
For other distributions, like Debian, change the URL and names to correspond
803-
with the specific distribution.
803+
$ sudo nano /etc/apt/sources.list
804804

805-
Then you should update the packages index::
805+
For other distributions, like Debian, change the URL and names to correspond
806+
with the specific distribution.
806807

807-
$ sudo apt-get update
808+
Then you should update the packages index::
808809

809-
Now you can install the build dependencies via ``apt``::
810+
$ sudo apt-get update
810811

811-
$ sudo apt-get build-dep python3
812-
$ sudo apt-get install pkg-config
812+
Now you can install the build dependencies via ``apt``::
813813

814-
If you want to build all optional modules, install the following packages and
815-
their dependencies::
814+
$ sudo apt-get build-dep python3
815+
$ sudo apt-get install pkg-config
816816

817-
$ sudo apt-get install build-essential gdb lcov pkg-config \
818-
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
819-
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
820-
lzma lzma-dev tk-dev uuid-dev zlib1g-dev libmpdec-dev libzstd-dev \
821-
inetutils-inetd
817+
If you want to build all optional modules, install the following packages and
818+
their dependencies::
822819

823-
Note that Debian 12 and Ubuntu 24.04 do not have the ``libmpdec-dev``
824-
package. You can safely remove it from the install list above and the
825-
Python build will use a bundled version. But we recommend using the system
826-
`libmpdec <https://www.bytereef.org/mpdecimal/doc/libmpdec/>`__ library.
827-
Either build it from sources or install this package from
828-
https://deb.sury.org.
820+
$ sudo apt-get install build-essential gdb lcov pkg-config \
821+
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
822+
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
823+
lzma lzma-dev tk-dev uuid-dev zlib1g-dev libmpdec-dev libzstd-dev \
824+
inetutils-inetd
825+
826+
Note that Debian 12 and Ubuntu 24.04 do not have the ``libmpdec-dev``
827+
package. You can safely remove it from the install list above and the
828+
Python build will use a bundled version. But we recommend using the system
829+
`libmpdec <https://www.bytereef.org/mpdecimal/doc/libmpdec/>`__ library.
830+
Either build it from sources or install this package from
831+
https://deb.sury.org.
829832

830833
.. tab:: macOS
831834

0 commit comments

Comments
 (0)