PYTHON 프로그래밍

본문 바로가기
사이트 내 전체검색


PYTHON 프로그래밍
PYTHON 프로그래밍

6. Centos 7에 Python3 설치하기

페이지 정보

작성자 관리자 댓글 0건 조회 4,722회 작성일 19-01-19 09:22

본문

6. Centos 7에 Python3 설치하기

IUS Community Project의 리포지토리를 yum의 리포지토리에 추가



[root@localhost ~]# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
Loaded plugins: fastestmirror, langpacks
ius-release.rpm                                          | 8.1 kB     00:00
Examining /var/tmp/yum-root-Sv7ooK/ius-release.rpm: ius-release-1.0-15.ius.centos7.noarch
Marking /var/tmp/yum-root-Sv7ooK/ius-release.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ius-release.noarch 0:1.0-15.ius.centos7 will be installed
--> Finished Dependency Resolution
base/7/x86_64                                            | 3.6 kB     00:00
epel/x86_64/metalink                                     | 7.4 kB     00:00
epel/x86_64                                              | 3.2 kB     00:00
epel/x86_64/group_gz                                     |  88 kB     00:00
epel/x86_64/updateinfo                                   | 925 kB     00:00
epel/x86_64/primary                                      | 3.5 MB     00:06
extras/7/x86_64                                          | 3.4 kB     00:00
mariadb                                                  | 2.9 kB     00:00
updates/7/x86_64                                         | 3.4 kB     00:00
virtualbox/7/x86_64/signature                            |  181 B     00:00
virtualbox/7/x86_64/signature                            | 1.1 kB     00:00 !!!
Dependencies Resolved
================================================================================
 Package          Arch        Version                   Repository         Size
================================================================================
Installing:
 ius-release      noarch      1.0-15.ius.centos7        /ius-release      8.5 k
Transaction Summary
================================================================================
Install  1 Package
Total size: 8.5 k
Installed size: 8.5 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ius-release-1.0-15.ius.centos7.noarch                        1/1
  Verifying  : ius-release-1.0-15.ius.centos7.noarch                        1/1
Installed:
  ius-release.noarch 0:1.0-15.ius.centos7
Complete!
[root@localhost ~]#




Python 3.6 확인



[root@localhost ~]# yum search python36
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.kaist.ac.kr
 * epel: mirror.premi.st
 * extras: ftp.kaist.ac.kr
 * ius: ius.mirror.constant.com
 * updates: ftp.kaist.ac.kr
ius                                                      | 2.3 kB     00:00
ius/x86_64/primary_db                                      | 315 kB   00:01
epel                                                                12604/12604
============================ N/S matched: python36 =============================
python36u-debuginfo.x86_64 : Debug information for package python36u
python36u-lxml-debuginfo.x86_64 : Debug information for package python36u-lxml
python36u-mod_wsgi-debuginfo.x86_64 : Debug information for package
                                    : python36u-mod_wsgi
python36u-psycopg2-debuginfo.x86_64 : Debug information for package
                                    : python36u-psycopg2
python36u-setproctitle-debuginfo.x86_64 : Debug information for package
                                        : python36u-setproctitle
python36u-test.x86_64 : The self-test suite for the main python36u package
uwsgi-plugin-python36u-debuginfo.x86_64 : Debug information for package
                                        : uwsgi-plugin-python36u
python36.x86_64 : Interpreter of the Python programming language
python36-debug.x86_64 : Debug version of the Python runtime
python36-devel.x86_64 : Libraries and header files needed for Python development
python36-libs.x86_64 : Python runtime libraries
python36-test.x86_64 : The self-test suite for the main python3 package
python36-tkinter.x86_64 : A GUI toolkit for Python
python36-tools.x86_64 : A collection of tools included with Python including
                      : 2to3 and idle
python36u.x86_64 : Interpreter of the Python programming language
python36u-debug.x86_64 : Debug version of the Python runtime
python36u-devel.x86_64 : Libraries and header files needed for Python
                       : development
python36u-gunicorn.noarch : Python WSGI application server
python36u-libs.x86_64 : Python runtime libraries
python36u-lxml.x86_64 : XML processing library combining libxml2/libxslt with
                      : the ElementTree API
python36u-mod_wsgi.x86_64 : A WSGI interface for Python web applications in
                          : Apache
python36u-pip.noarch : A tool for installing and managing Python packages
python36u-psycopg2.x86_64 : A PostgreSQL database adapter for Python
python36u-redis.noarch : Python interface to the Redis key-value store
python36u-setproctitle.x86_64 : Python module to customize a process title
python36u-setuptools.noarch : Easily build and distribute Python packages
python36u-tkinter.x86_64 : A GUI toolkit for Python
python36u-tools.x86_64 : A collection of tools included with Python including
                       : 2to3 and idle
uwsgi-plugin-python36u.x86_64 : uWSGI - Plugin for Python support
  Name and summary matches only, use "search all" for everything.
[root@localhost ~]#




Python 3.6 설치



[root@localhost ~]# yum install -y python36u python36u-libs python36u-devel python36u-pip
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.kaist.ac.kr
 * epel: mirror.premi.st
 * extras: ftp.kaist.ac.kr
 * ius: mirrors.kernel.org
 * updates: ftp.kaist.ac.kr
Resolving Dependencies
--> Running transaction check
---> Package python36u.x86_64 0:3.6.5-1.ius.centos7 will be installed
---> Package python36u-devel.x86_64 0:3.6.5-1.ius.centos7 will be installed
---> Package python36u-libs.x86_64 0:3.6.5-1.ius.centos7 will be installed
---> Package python36u-pip.noarch 0:9.0.1-1.ius.centos7 will be installed
--> Processing Dependency: python36u-setuptools for package: python36u-pip-9.0.1-1.ius.centos7.noarch
--> Running transaction check
---> Package python36u-setuptools.noarch 0:39.0.1-1.ius.centos7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package                   Arch        Version                   Repository
                                                                           Size
================================================================================
Installing:
 python36u                 x86_64      3.6.5-1.ius.centos7       ius       57 k
 python36u-devel           x86_64      3.6.5-1.ius.centos7       ius      839 k
 python36u-libs            x86_64      3.6.5-1.ius.centos7       ius      8.7 M
 python36u-pip             noarch      9.0.1-1.ius.centos7       ius      1.8 M
Installing for dependencies:
 python36u-setuptools      noarch      39.0.1-1.ius.centos7      ius      642 k
Transaction Summary
================================================================================
Install  4 Packages (+1 Dependent package)
Total download size: 12 M
Installed size: 55 M
Downloading packages:
경고: /var/cache/yum/x86_64/7/ius/packages/python36u-setuptools-39.0.1-1.ius.centos7.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY
Public key for python36u-setuptools-39.0.1-1.ius.centos7.noarch.rpm is not installed
(1/5): python36u-setuptools-39.0.1-1.ius.centos7.noarch.rp | 642 kB   00:00
(2/5): python36u-devel-3.6.5-1.ius.centos7.x86_64.rpm      | 839 kB   00:01
(3/5): python36u-pip-9.0.1-1.ius.centos7.noarch.rpm        | 1.8 MB   00:02
(4/5): python36u-3.6.5-1.ius.centos7.x86_64.rpm            |  57 kB   00:02
(5/5): python36u-libs-3.6.5-1.ius.centos7.x86_64.rpm       | 8.7 MB   00:03
--------------------------------------------------------------------------------
Total                                              3.2 MB/s |  12 MB  00:03
Retrieving key from file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
Importing GPG key 0x9CD4953F:
 Userid     : "IUS Community Project <coredev@iuscommunity.org>"
 Fingerprint: 8b84 6e3a b3fe 6462 74e8 670f da22 1cdf 9cd4 953f
 Package    : ius-release-1.0-15.ius.centos7.noarch (installed)
 From       : /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python36u-libs-3.6.5-1.ius.centos7.x86_64                    1/5
  Installing : python36u-3.6.5-1.ius.centos7.x86_64                         2/5
  Installing : python36u-setuptools-39.0.1-1.ius.centos7.noarch             3/5
  Installing : python36u-pip-9.0.1-1.ius.centos7.noarch                     4/5
  Installing : python36u-devel-3.6.5-1.ius.centos7.x86_64                   5/5
  Verifying  : python36u-pip-9.0.1-1.ius.centos7.noarch                     1/5
  Verifying  : python36u-3.6.5-1.ius.centos7.x86_64                         2/5
  Verifying  : python36u-devel-3.6.5-1.ius.centos7.x86_64                   3/5
  Verifying  : python36u-libs-3.6.5-1.ius.centos7.x86_64                    4/5
  Verifying  : python36u-setuptools-39.0.1-1.ius.centos7.noarch             5/5
Installed:
  python36u.x86_64 0:3.6.5-1.ius.centos7
  python36u-devel.x86_64 0:3.6.5-1.ius.centos7
  python36u-libs.x86_64 0:3.6.5-1.ius.centos7
  python36u-pip.noarch 0:9.0.1-1.ius.centos7
Dependency Installed:
  python36u-setuptools.noarch 0:39.0.1-1.ius.centos7
Complete!
[root@localhost ~]#





설치 확인




[root@localhost ~]# python3.6 -V
Python 3.6.5
[root@localhost ~]# which python3.6
/bin/python3.6
[root@localhost ~]#




Alias 설정




현재 python 커맨드는 2.7로 설정 되어 있음




[root@localhost ~]# python -V
Python 2.7.5
[root@localhost ~]#




현재 python 커맨드의 Alias를 확인하면 python → python2 → python2.7로 되어 있음




[root@localhost ~]# ls -l /bin/python*
lrwxrwxrwx 1 root root     7  5월 15 17:08 /bin/python -> python2
lrwxrwxrwx 1 root root     9  5월 15 17:08 /bin/python2 -> python2.7
-rwxr-xr-x 1 root root  7216  4월 11 16:36 /bin/python2.7
-rwxr-xr-x 2 root root 11312  4월 11 07:11 /bin/python3.6
lrwxrwxrwx 1 root root    26  7월  9 10:37 /bin/python3.6-config -> /usr/bin/python3.6m-config
-rwxr-xr-x 2 root root 11312  4월 11 07:11 /bin/python3.6m
-rwxr-xr-x 1 root root   173  4월 11 07:10 /bin/python3.6m-config
-rwxr-xr-x 1 root root  3435  4월 11 07:08 /bin/python3.6m-x86_64-config
[root@localhost ~]#




python → python3 → python3.6으로 설정




[root@localhost ~]# ln -s /bin/python3.6 /bin/python3

python은 yum에서 사용하므로 python3을 python으로 link했을때는 yum 사용시 오류가 발생합니다.
다시 python2을 python으로 link해야 하므로 python3까지만 link해도 좋을 듯합니다.

[root@localhost ~]# unlink /bin/python
[root@localhost ~]# ln -s /bin/python3 /bin/python
[root@localhost ~]#

[root@localhost ~]# python3 -V
Python 3.6.5
[root@localhost ~]#




pip 설정




[root@localhost ~]# ln -s /bin/pip3.6 /bin/pip3
[root@localhost ~]#
 

댓글목록

등록된 댓글이 없습니다.


개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.