Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
tachtler:installation_von_python3_in_centos_7

Installation von Python3 in CentOS 7

Python3 ist eine Programmiersprache, die sich hervorragend für Prototyping bis hin zu komplexen Projekten eignet und in Systeme effektiver integrieren werden kann.

Beschreibung Externer Link
Homepage https://www.python.org/
Dokumentation https://docs.python.org/3/

Ab hier werden root-Rechte zur Ausführung der nachfolgenden Befehle benötigt. Um der Benutzer root zu werden, geben Sie bitte nachfolgenden Befehl ein:

$ su -
Password: 

Vorbereitung

Zur Installation von Python3 über ein rpm-Paket, soll hier das Repository eines Drittanbieters genutzt werden, da Python3 nicht im CentOS-Repository enthalten ist.

Nachfolgend soll das Repository des Drittanbieters EPEL genutzt werden. Eine Anleitung, wie das Repository des Drittanbieters EPEL eingebunden werden könnte, kann unter nachfolgendem internen Link nachgelesen werden:

Installation

Zur Installation von Python3 wird nachfolgendes Paket benötigt:

  • python36 - ist im epel-Repository des Drittanbieters EPEL
  • python36-libs - ist im epel-Repository des Drittanbieters EPEL
  • python36-devel - ist im epel-Repository des Drittanbieters EPEL
  • python36-pip - ist im epel-Repository des Drittanbieters EPEL

enthalten

Mit nachfolgendem Befehl, wird das Pakete python36 installiert:

# yum install -y python36 python36-libs python36-devel python36-pip
Loaded plugins: changelog, langpacks, priorities
adobe-linux-x86_64                                       | 2.9 kB     00:00     
base                                                     | 3.6 kB     00:00     
epel                                                     | 5.3 kB     00:00     
extras                                                   | 3.4 kB     00:00     
mailserver.guru-os                                       | 2.9 kB     00:00     
teamviewer                                               | 2.5 kB     00:00     
updates                                                  | 3.4 kB     00:00     
(1/3): teamviewer/x86_64/primary_db                        |  68 kB   00:00     
(2/3): epel/x86_64/updateinfo                              | 1.0 MB   00:00     
(3/3): epel/x86_64/primary_db                              | 6.8 MB   00:00     
325 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package python36.x86_64 0:3.6.8-1.el7 will be installed
---> Package python36-devel.x86_64 0:3.6.8-1.el7 will be installed
--> Processing Dependency: python-rpm-macros for package: python36-devel-3.6.8-1.el7.x86_64
--> Processing Dependency: python3-rpm-macros for package: python36-devel-3.6.8-1.el7.x86_64
--> Processing Dependency: redhat-rpm-config for package: python36-devel-3.6.8-1.el7.x86_64
---> Package python36-libs.x86_64 0:3.6.8-1.el7 will be installed
---> Package python36-pip.noarch 0:8.1.2-8.el7 will be installed
--> Processing Dependency: python36-setuptools for package: python36-pip-8.1.2-8.el7.noarch
--> Running transaction check
---> Package python-rpm-macros.noarch 0:3-25.el7 will be installed
--> Processing Dependency: python-srpm-macros for package: python-rpm-macros-3-25.el7.noarch
---> Package python3-rpm-macros.noarch 0:3-25.el7 will be installed
---> Package python36-setuptools.noarch 0:39.2.0-3.el7 will be installed
---> Package redhat-rpm-config.noarch 0:9.1.0-87.el7.centos will be installed
--> Processing Dependency: dwz >= 0.4 for package: redhat-rpm-config-9.1.0-87.el7.centos.noarch
--> Processing Dependency: perl-srpm-macros for package: redhat-rpm-config-9.1.0-87.el7.centos.noarch
--> Running transaction check
---> Package dwz.x86_64 0:0.11-3.el7 will be installed
---> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed
---> Package python-srpm-macros.noarch 0:3-25.el7 will be installed
--> Finished Dependency Resolution

Changes in packages about to be updated:


Dependencies Resolved

================================================================================
 Package                  Arch        Version                   Repository
                                                                           Size
================================================================================
Installing:
 python36                 x86_64      3.6.8-1.el7               epel       67 k
 python36-devel           x86_64      3.6.8-1.el7               epel      850 k
 python36-libs            x86_64      3.6.8-1.el7               epel      8.6 M
 python36-pip             noarch      8.1.2-8.el7               epel      1.6 M
Installing for dependencies:
 dwz                      x86_64      0.11-3.el7                base       99 k
 perl-srpm-macros         noarch      1-8.el7                   base      4.6 k
 python-rpm-macros        noarch      3-25.el7                  epel      8.0 k
 python-srpm-macros       noarch      3-25.el7                  epel      7.5 k
 python3-rpm-macros       noarch      3-25.el7                  epel      6.7 k
 python36-setuptools      noarch      39.2.0-3.el7              epel      631 k
 redhat-rpm-config        noarch      9.1.0-87.el7.centos       base       81 k

Transaction Summary
================================================================================
Install  4 Packages (+7 Dependent packages)

Total download size: 12 M
Installed size: 51 M
Downloading packages:
(1/11): perl-srpm-macros-1-8.el7.noarch.rpm                | 4.6 kB   00:00     
(2/11): python-rpm-macros-3-25.el7.noarch.rpm              | 8.0 kB   00:00     
(3/11): dwz-0.11-3.el7.x86_64.rpm                          |  99 kB   00:00     
(4/11): python-srpm-macros-3-25.el7.noarch.rpm             | 7.5 kB   00:00     
(5/11): python3-rpm-macros-3-25.el7.noarch.rpm             | 6.7 kB   00:00     
(6/11): python36-3.6.8-1.el7.x86_64.rpm                    |  67 kB   00:00     
(7/11): python36-devel-3.6.8-1.el7.x86_64.rpm              | 850 kB   00:00     
(8/11): python36-pip-8.1.2-8.el7.noarch.rpm                | 1.6 MB   00:00     
(9/11): python36-setuptools-39.2.0-3.el7.noarch.rpm        | 631 kB   00:00     
(10/11): redhat-rpm-config-9.1.0-87.el7.centos.noarch.rpm  |  81 kB   00:00     
(11/11): python36-libs-3.6.8-1.el7.x86_64.rpm              | 8.6 MB   00:01     
--------------------------------------------------------------------------------
Total                                              8.6 MB/s |  12 MB  00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python36-libs-3.6.8-1.el7.x86_64                            1/11 
  Installing : python36-3.6.8-1.el7.x86_64                                 2/11 
  Installing : python36-setuptools-39.2.0-3.el7.noarch                     3/11 
  Installing : python3-rpm-macros-3-25.el7.noarch                          4/11 
  Installing : dwz-0.11-3.el7.x86_64                                       5/11 
  Installing : perl-srpm-macros-1-8.el7.noarch                             6/11 
  Installing : redhat-rpm-config-9.1.0-87.el7.centos.noarch                7/11 
  Installing : python-srpm-macros-3-25.el7.noarch                          8/11 
  Installing : python-rpm-macros-3-25.el7.noarch                           9/11 
  Installing : python36-devel-3.6.8-1.el7.x86_64                          10/11 
  Installing : python36-pip-8.1.2-8.el7.noarch                            11/11 
  Verifying  : python-srpm-macros-3-25.el7.noarch                          1/11 
  Verifying  : python36-devel-3.6.8-1.el7.x86_64                           2/11 
  Verifying  : python36-setuptools-39.2.0-3.el7.noarch                     3/11 
  Verifying  : python36-pip-8.1.2-8.el7.noarch                             4/11 
  Verifying  : perl-srpm-macros-1-8.el7.noarch                             5/11 
  Verifying  : python36-3.6.8-1.el7.x86_64                                 6/11 
  Verifying  : python-rpm-macros-3-25.el7.noarch                           7/11 
  Verifying  : dwz-0.11-3.el7.x86_64                                       8/11 
  Verifying  : python36-libs-3.6.8-1.el7.x86_64                            9/11 
  Verifying  : python3-rpm-macros-3-25.el7.noarch                         10/11 
  Verifying  : redhat-rpm-config-9.1.0-87.el7.centos.noarch               11/11 

Installed:
  python36.x86_64 0:3.6.8-1.el7          python36-devel.x86_64 0:3.6.8-1.el7    
  python36-libs.x86_64 0:3.6.8-1.el7     python36-pip.noarch 0:8.1.2-8.el7      

Dependency Installed:
  dwz.x86_64 0:0.11-3.el7                                                       
  perl-srpm-macros.noarch 0:1-8.el7                                             
  python-rpm-macros.noarch 0:3-25.el7                                           
  python-srpm-macros.noarch 0:3-25.el7                                          
  python3-rpm-macros.noarch 0:3-25.el7                                          
  python36-setuptools.noarch 0:39.2.0-3.el7                                     
  redhat-rpm-config.noarch 0:9.1.0-87.el7.centos                                

Complete!

Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit den Paket python36 installiert wurden.

# rpm -qil python36
Name        : python36
Version     : 3.6.8
Release     : 1.el7
Architecture: x86_64
Install Date: Fri 06 Sep 2019 03:35:15 PM CEST
Group       : Unspecified
Size        : 39976
License     : Python
Signature   : RSA/SHA256, Fri 26 Apr 2019 01:09:39 AM CEST, Key ID 6a2faea2352c64e5
Source RPM  : python36-3.6.8-1.el7.src.rpm
Build Date  : Thu 25 Apr 2019 11:52:31 PM CEST
Build Host  : buildvm-14.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://www.python.org/
Bug URL     : https://bugz.fedoraproject.org/python36
Summary     : Interpreter of the Python programming language
Description :
Python is an accessible, high-level, dynamically typed, interpreted programming
language, designed with an emphasis on code readability.
It includes an extensive standard library, and has a vast ecosystem of
third-party libraries.

The python36 package provides the "python3" executable: the reference
interpreter for the Python language, version 3.
The majority of its standard library is provided in the python36-libs package,
which should be installed automatically along with python36.
The remaining parts of the Python standard library are broken out into the
python36-tkinter and python36-test packages, which may need to be installed
separately.

Documentation for Python is provided in the python36-docs package.

Packages containing additional libraries for Python are generally named with
the "python36-" prefix.
/usr/bin/pydoc3
/usr/bin/pydoc3.6
/usr/bin/python3
/usr/bin/python3.6
/usr/bin/python3.6m
/usr/bin/python36
/usr/bin/pyvenv
/usr/bin/pyvenv-3.6
/usr/share/doc/python36-3.6.8
/usr/share/doc/python36-3.6.8/README.rst
/usr/share/licenses/python36-3.6.8
/usr/share/licenses/python36-3.6.8/LICENSE
/usr/share/man/man1/python3.1.gz
/usr/share/man/man1/python3.6.1.gz

Zum Abschluss kann mit nachfolgendem Befehl überprüft werden, ob ein Aufruf möglich ist und Python3 nutzbar ist:

# /usr/bin/python3 -V
Python 3.6.8

Eclipse IDE - Python

Eclipse ist eine hervorragende Entwicklungsumgebung für JAVA-Projekte aber auch andere Programmiersprachen wie C/C++ oder PHP. Eclipse besticht durch eine Vielzahl von „Add-ons“ und Erweiterungen für die Entwicklungsumgebung und dessen Entwicklern.

Beschreibung Externer Link
Homepage http://www.eclipse.org
Dokumentation http://help.eclipse.org
Herunterladen http://www.eclipse.org/downloads/

Um in Eclipse mit Python3 komfortable programmieren zu können, ist es erforderlich, die Erweiterung PyDev zu installieren.

Dazu muss innerhalb von Eclipse der Menüpunkt [Help|Hilfe] aufgerufen werden und das Untermenü [Eclipse Marketplace|Eclipse Marktplatz] ausgewählt werden, wie nachfolgende Bildschirmkopie zeigt:

Eclipse - Help - Eclipse Marketplace

In dem sich neu öffnenden Dialogfenster muss nun im Eingabefeld [Find|Suche] nachfolgender Suchbegriff eingegeben werden:

  • PyDev

und dies durch drücken der [Enter|Return|Eingabe]-Taste bestätigt werden, so dass nachfolgende Suchtrefferauswahl erscheinen sollte, wie in nachfolgender Bildschirmkopie dargestellt:

Eclipse - Help - Eclipse Marketplace - PyDev

Als nächstes wird die Schaltfläche [Install|Installieren], rechts neben dem Treffer mit der Bezeichnung

  • PyDev - Python IDE for Eclipse x.x.x

ausgewählt, woraufhin nachfolgender Bildschirm erscheinen sollte:

Eclipse - Help - Eclipse Marketplace - PyDev - Install

Durch drücken der Schaltfläche [Confirm >|Zustimmen >] sollte anschließend der nächste Bildschirm erscheinen, wie nachfolgende Bildschirmkopie zeigt:

Eclipse - Help - Eclipse Marketplace - PyDev - Install - Confirm

Durch Auswahl der Radio-Schaltfläche [I accept the terms of the licence agreement|Ich akzeptiere die Lizenz-Bedingungen], wird die Installation, durch drücken der Schaltfläche [Finisch|Fertig] anschließend durchgeführt und endet mit der Aufforderung Eclipse neu starten zu dürfen. Hier muss nun die Schaltfläche [Restart|Neustart] ausgewählt werden, wie nachfolgende Bildschirmkopie zeigt:

Eclipse - Help - Eclipse Marketplace - PyDev - Install - Confirm - Restart

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
tachtler/installation_von_python3_in_centos_7.txt · Zuletzt geändert: 2019/12/07 07:45 von klaus