«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

VIDEOCUBE

Python3 설치 본문

개발/파이썬

Python3 설치

라떼청년 2018. 2. 2. 01:13

CentOS 6.3 으로 Python3 설치


1. CentOS 6.3 기본 설치 버전 

  - version 2.6.6 

root@linux-03:/root> python

Python 2.6.6 (r266:84292, Jun 18 2012, 14:18:47) 

[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> exit()



root@linux-03:/root> yum update python

Dependencies Resolved


================================================================================

 Package             Arch           Version                  Repository    Size

================================================================================

Updating:

 python              x86_64         2.6.6-66.el6_8           base          76 k

Installing for dependencies:

 make                x86_64         1:3.81-23.el6            base         389 k

Updating for dependencies:

 openssl             x86_64         1.0.1e-57.el6            base         1.5 M

 python-libs         x86_64         2.6.6-66.el6_8           base         5.3 M

 zlib                x86_64         1.2.3-29.el6             base          73 k


Transaction Summary

================================================================================

Install       1 Package(s)

Upgrade       4 Package(s)


Total download size: 7.4 M

Is this ok [y/N]: 



Download

https://www.python.org/downloads/


https://www.python.org/downloads/release/python-364/

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz


root@linux-03:/root/src> tar xvfz Python-3.6.4.tgz

root@linux-03:/root/src> cd Python-3.6.4

합계 1036

drwxr-xr-x. 18 501 501   4096 2017-12-19 14:36 Doc

drwxr-xr-x.  2 501 501   4096 2017-12-19 13:53 Grammar

drwxr-xr-x.  2 501 501   4096 2017-12-19 13:53 Include

-rw-r--r--.  1 501 501  12757 2017-12-19 13:53 LICENSE

drwxr-xr-x. 33 501 501   4096 2017-12-19 13:53 Lib

drwxr-xr-x.  8 501 501   4096 2017-12-19 13:53 Mac

-rw-r--r--.  1 501 501  61139 2017-12-19 13:53 Makefile.pre.in

drwxr-xr-x.  2 501 501   4096 2017-12-19 14:36 Misc

drwxr-xr-x. 13 501 501   4096 2017-12-19 13:53 Modules

drwxr-xr-x.  4 501 501   4096 2017-12-19 13:53 Objects

drwxr-xr-x.  6 501 501   4096 2017-12-19 13:53 PC

drwxr-xr-x.  2 501 501   4096 2017-12-19 13:53 PCbuild

drwxr-xr-x.  2 501 501   4096 2017-12-19 13:53 Parser

drwxr-xr-x.  2 501 501   4096 2017-12-19 13:53 Programs

drwxr-xr-x.  3 501 501   4096 2017-12-19 13:53 Python

-rw-r--r--.  1 501 501   9269 2017-12-19 13:53 README.rst

drwxr-xr-x. 23 501 501   4096 2017-12-19 13:53 Tools

-rw-r--r--.  1 501 501  13335 2017-12-19 13:53 aclocal.m4

-rwxr-xr-x.  1 501 501  44259 2017-12-19 13:53 config.guess

-rwxr-xr-x.  1 501 501  36515 2017-12-19 13:53 config.sub

-rwxr-xr-x.  1 501 501 489889 2017-12-19 13:53 configure

-rw-r--r--.  1 501 501 162850 2017-12-19 13:53 configure.ac

-rwxr-xr-x.  1 501 501   7122 2017-12-19 13:53 install-sh

-rw-r--r--.  1 501 501  42074 2017-12-19 13:53 pyconfig.h.in

-rw-r--r--.  1 501 501 103237 2017-12-19 13:53 setup.py

root@linux-03:/root/src/Python-3.6.4> ./configure 

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking for python3.6... no

checking for python3... no

checking for python... python

checking for --enable-universalsdk... no

checking for --with-universal-archs... no

checking MACHDEP... linux

checking for --without-gcc... no

checking for --with-icc... no

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/root/src/Python-3.6.4':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details


C compiler 를 찾을 수 없다고 합니다.

gcc 설치가 되어 있는 지 확인

root@linux-03:/root/src/Python-3.6.4> yum list installed gcc

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.kaist.ac.kr

 * extras: ftp.kaist.ac.kr

 * updates: ftp.kaist.ac.kr

Error: No matching Packages to list


gcc 설치



./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" --enable-optimizations


make 

make install

Traceback (most recent call last):

  File "/root/src/Python-3.6.4/Lib/runpy.py", line 193, in _run_module_as_main

    "__main__", mod_spec)

  File "/root/src/Python-3.6.4/Lib/runpy.py", line 85, in _run_code

    exec(code, run_globals)

  File "/root/src/Python-3.6.4/Lib/ensurepip/__main__.py", line 5, in <module>

    sys.exit(ensurepip._main())

  File "/root/src/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main

    default_pip=args.default_pip,

  File "/root/src/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap

    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)

  File "/root/src/Python-3.6.4/Lib/ensurepip/__init__.py", line 27, in _run_pip

    import pip

zipimport.ZipImportError: can't decompress data; zlib not available

make: *** [install] 오류 1


zlib 가 없다고 한다


zlib-devel 설치

root@linux-03:/root/src/Python-3.6.4> yum install zlib-devel

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.kaist.ac.kr

 * extras: ftp.kaist.ac.kr

 * updates: ftp.kaist.ac.kr

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed

--> Processing Dependency: /usr/bin/pkg-config for package: zlib-devel-1.2.3-29.el6.x86_64

--> Running transaction check

---> Package pkgconfig.x86_64 1:0.23-9.1.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


============================================================================================

 Package               Arch              Version                      Repository       Size

============================================================================================

Installing:

 zlib-devel            x86_64            1.2.3-29.el6                 base             44 k

Installing for dependencies:

 pkgconfig             x86_64            1:0.23-9.1.el6               base             70 k


Transaction Summary

============================================================================================

Install       2 Package(s)


Total download size: 114 k

Installed size: 252 k

Is this ok [y/N]: 

pip 를 이용할 때 openssl 관련 에러를 발생할 수 있다.


sudo yum install openssl-dev

추가로 openssl-dev 를 설치하자


root@linux-03:/usr/local/bin> tree

.

├── 2to3 -> 2to3-3.6

├── 2to3-3.6

├── easy_install-3.6

├── idle3 -> idle3.6

├── idle3.6

├── pip3

├── pip3.6

├── pydoc3 -> pydoc3.6

├── pydoc3.6

├── python3 -> python3.6

├── python3-config -> python3.6-config

├── python3.6

├── python3.6-config -> python3.6m-config

├── python3.6m

├── python3.6m-config

├── pyvenv -> pyvenv-3.6

└── pyvenv-3.6


0 directories, 17 files


3.6 이 설치 되었다.


링크를 다음과 같이 걸자

ln -s  /usr/local/bin/python3.6 /usr/bin/python3

ln -s  /usr/local/bin/pip3 /usr/bin/pip3

root@linux-03:/data> python3

Python 3.6.4 (default, Feb  2 2018, 01:03:14) 

[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> 







반응형
Comments