Skip to content

CentOS 6.5 + Python2.7 + MySQL_Python-1.2.3

조회 수 7944 추천 수 0 2014.03.28 16:56:04
YUM 설치 하면 간단 한거지만 특정프로그램 사용을 인하여 삽질을 기록 합니다. 

Python2.7 설치는 간단하기에 생략하고 
MySQL_Python-1.2.3 연동 설명만 합니다.

우선 MySQL_Python-1.2.3 설치 하기 위해서는 setuptools 필요 합니다.

아래는 setuptools설치 화면 입니다.

[root@ MySQL-python-1.2.3]# ../bin/python2.7 ez_setup.py -U setuptools

Searching for setuptools
Reading https://pypi.python.org/simple/setuptools/
Reading http://peak.telecommunity.com/snapshots/
Reading https://pypi.python.org/pypi/setuptools
Best match: setuptools 3.3
Processing setuptools-3.3-py2.7.egg
setuptools 3.3 is already the active version in easy-install.pth
Installing easy_install script to /opt/hqueue/bin
Installing easy_install-2.7 script to /opt/hqueue/bin

Using /opt/hqueue/lib/python2.7/site-packages/setuptools-3.3-py2.7.egg
Processing dependencies for setuptools
Finished processing dependencies for setuptools




MySQL-python-1.2.3 빌드 진행 한다

[root@RND003 MySQL-python-1.2.3]# ../bin/python2.7 setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc44 -fno-strict-aliasing -O3 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/hqueue/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-prote다ctor --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
In file included from /usr/include/mysql/my_config.h:14,
                 from _mysql.c:36:
/usr/include/mysql/my_config_x86_64.h:422:1: warning: "HAVE_WCSCOLL" redefined
In file included from /opt/hqueue/include/python2.7/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/opt/hqueue/include/python2.7/pyconfig.h:902:1: warning: this is the location of the previous definition
gcc44 -pthread -shared -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/lib build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/python2.7/python_ucs4/lib -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
error: command 'gcc44' failed with exit status 1
[root@MySQL-python-1.2.3]# 

python2.7 경로를 찾지 못하여 에러로 인해 진행 빌드 진행 안됨


참고: CentOS 6.5 gcc44 이름으로 RPM 패키지가 없음
        gcc44 찾지 못할경우 : ln -s /usr/bin/gcc /usr/bin/gcc44 심볼링크 걸어 준다


방법 1 
에러 메세지 중에  -lpython2.7 구간을 삭제후 아래처럼 커맨드로 입력 후 so 파일을 만든다.

gcc44 -pthread -shared -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/lib build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/python2.7/python_ucs4/lib -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl  -o build/lib.linux-x86_64-2.7/_mysql.so


방법2
에러 메세지 중에  -lpython2.7 구간을 삭제후  -L/파이선설치경로/lib 경로를 입력 후 so 파일을 만든다.

gcc44 -pthread -shared -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/lib build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/파이선설치경로/lib -L/home/prisms/builder-new/WeeklyDevTools/dev_tools/local/python2.7/python_ucs4/lib -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/_mysql.so

커맨드로 입력후 정상적으로 진행 되면 아무러 메세지가 나오지 않음



so 파일이 생성되어 인스톨로 바로 진행 한다


[root@MySQL-python-1.2.3]# ../bin/python2.7 setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql_exceptions.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql.so -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/cursors.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/release.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/connections.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/times.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/converters.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb
creating build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FLAG.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/ER.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/REFRESH.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CLIENT.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CR.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
byte-compiling build/bdist.linux-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/release.py to release.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/times.py to times.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/converters.py to converters.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/__init__.py to __init__.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.linux-x86_64/egg/_mysql.py to _mysql.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/MySQL_python-1.2.3-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing MySQL_python-1.2.3-py2.7-linux-x86_64.egg
Copying MySQL_python-1.2.3-py2.7-linux-x86_64.egg to /opt/hqueue/lib/python2.7/site-packages
Adding MySQL-python 1.2.3 to easy-install.pth file

Installed /opt/*****/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg
Processing dependencies for MySQL-python==1.2.3
Finished processing dependencies for MySQL-python==1.2.3

[root@ src]# /opt/******/bin/python2.7
Python 2.7.5 (default, Oct 24 2013, 12:22:56) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> 
위 하면은 연동 함수 테스트 화면이다 아무로 메세지가 없어야 정상

아~~ 드뎌 설치 이거 설치 하려고 4일간 삽질을 했다 ㅠ.ㅠ
팀장님이 알려주신 방법으로 30분도 안걸렸다는게 허무함 ㅠ.ㅠ


profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/278483/15f/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
367 linux daemon (리눅스 데몬 설명) ADMINPLAY 2014-02-26 647806
366 대용량 HDD 파티셔닝(Mass storage Partitioning) (GPT 파... ADMINPLAY 2010-04-14 73588
365 FFMPEG를 가장쉽게 설치하는 방법(ffmpeg-php 등) ADMINPLAY 2010-05-03 66358
364 rrdtool 컴파일시 에러 configure: error: Please fix the... ADMINPLAY 2009-08-08 64715
363 커널 2.6으로 업그레이드!「A to Z」 ADMINPLAY 2009-08-08 64363
362 e2fsck - 파일 시스템 복구 및 검사. - fsck file ADMINPLAY 2010-09-12 60903
361 배치파일을 이용한 백업방법 l2zeo 2010-03-31 59533
360 Maskrading ADMIN 2008-11-11 58734
359 시스템 백업과 응급 복구 ADMINPLAY 2009-05-11 58693
358 리눅스 전원부터 부팅이 되기까지의 과정이해 ADMIN 2008-11-11 57569
357 리눅스 디렉토리 구조와 파티션 관리의 기본 ADMINPLAY 2009-05-22 57518
356 hdparm 세부옵션 ADMINPLAY 2012-01-16 55081
355 CentOS 설치 - VMware 상에서 CentOS 설치하기 file l2zeo 2010-02-24 52101
354 Red Hat Linux 9 ADMINPLAY 2009-09-24 51551
353 Dell OMSA 설치 및 이용방법 ADMINPLAY 2014-08-13 49751
352 2TB이상의 Disk를 사용한 Raid6 구성 ADMINPLAY 2015-08-08 46162
351 sulinux 1.0. 서버 패키지 리스트 ADMINPLAY 2011-04-30 45588
350 ORA-01031: insufficient privileges 오류 ADMINPLAY 2010-02-24 41013
349 [APM] 리눅스에서 Apache, PHP, MySQL 등 제거 방법 ADMINPLAY 2009-06-29 39388
348 AIX 필수 명령어 ADMINPLAY 2009-12-10 39118

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234