이 문서는 Perl Thread 문서를 기반으로 작성되었습니다. Thread 의 기초부터해서 Thread의 구현을 Perl, Python 으로 직접 구현해보고 비교하도록 하겠습니다. 출처: http://www.xav.com/perl/lib/Pod/perlthrtut.html Thread? 쓰레드(Thread)는 프로세스(Process)보다 작은 프로그램 단위 입니다. 좀 더 정확하게 말하자면 프로그램은 적어도 한개의 프로세스로 구성되며 적어도 하나의 쓰레드로 구성됩니다. 적어도 하나의 프로세스에서 하나의 쓰레드는 결국 하나의 실행 포인트를 가집니다. 적어도 하나의 프로세스내에서 다중 쓰레드를 쓴다는 것은 결국 다중의 실행 포인트를 가진다는 것을 의미 합니다. 다중의 실행 포인트? 요즘에 멀티코어(Multi Core) CPU가 많이 나옵니다. 프로그램은 이 멀티코어 CPU에 의해서 실행되는데 […]
Installation, Linux
Python 3 설치
Python 3 설치. 현재 Python 2.x 버전이 2019년까지 수면을 연장했지만 이미 많은 모듈들이 2.x 버전에서 개발이 중단되거나 Python 3.x 를 지원하기 시작했다. 앞으로는 Python 2.x 를 개발하더라도 Python 3.x 와 호환을 고려해서 작성해야 한다. 1. Downloads and Unpack 다운로드는 Python 홈페이지에서 받는다.
|
1 2 3 |
wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz tar xvzf Python-3.4.1.tgz -C /usr/src |
2. Configure and Compile and Install
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
export LDFLAGS=-L/usr/lib64 export LINKCC="gcc" if pkg-config openssl ; then export CFLAGS="$CFLAGS `pkg-config --cflags openssl`" export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`" fi export CHOST="x86_64-pc-linux-gnu" export CC=gcc ./configure --prefix=/usr/local/python3 --enable-shared --with-system-expat --with-signal-module --with-threads make make install |
3. 후속작업 설치한 후에 python3 을 실행하면 다음과 같이 실행이되지 않는다.
|
1 2 |
/usr/local/python3/bin/python3 /usr/local/python3/bin/python3: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory |
공유라이브러리가 없기 때문에 나타나는 현상으로 다음과 같이 공유라이브러리를 인식시켜준다.
|
1 2 3 4 |
]# vim /etc/ld.so.conf.d/python3.conf /usr/local/python3/lib ldconfig |
Installation, Linux
Python 2.7 설치하기.
최근에 발표된 CentOS 7 에서는 Python 2.7.5 버전이 설치되어 있습니다. 하지만 CentOS 6.x 버전에서는 Python 2.6 버전이 설치되어 있어서 2.7 버전 소스 설치에 대해 정리했습니다. Python 2.7 은 Python 2,x 대의 마지막 버전이 될 것입니다. 현재 Python 3.x 가 최신이지만 Python 2.x 대도 여전히 많이 쓰이고 모듈도 많이 있어서 지금도 많이 쓰입니다. 특히나 Python 2.7 은 다음과 같은 기능상의 변화가 있었습니다.
|
1 2 3 |
Updated module: The io library has been upgraded to the version shipped with Python 3.1. For 3.1, the I/O library was entirely rewritten in C and is 2 to 20 times faster depending on the task being performed. The original Python version was renamed to the _pyio module. |
1. Download and Unpack
|
1 2 3 4 |
cd /usr/src wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz tar xzf Python-2.7.8.tgz cd Python-2.7.8 |
2. Configure && make && install
|
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 32 33 34 |
# python 기능이 필요한 라이브러리 추가 설치. yum install -y valgrind-devel.x86_64 yum install -y sqlite-devel.x86_64 # Complie option For AMD 지정. export CFLAGS="-m64 -march=generic -D_GNU_SOURCE -fPIC -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" export CXXFLAGS="-m64 -march=generic -D_GNU_SOURCE -fPIC -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" export LDFLAGS=-L/usr/lib64 export LINKCC="gcc" # LDFLAGS for openssl if pkg-config openssl ; then export CFLAGS="$CFLAGS `pkg-config --cflags openssl`" export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`" fi export CHOST="x86_64-pc-linux-gnu" export CC=gcc # configure ./configure --prefix=/usr/local/python2.7 \ --with-signal-module \ --with-threads \ --with-pth \ --with-fpectl \ --enable-shared \ --enable-unicode=ucs4 \ --with-valgrind \ --enable-big-digits \ --with-wctype-functions make make install |
3. Post Python 설치를 시스템 Path […]