Skip to content

CentOS 6.5 + Python2.7 + MySQL_Python-1.2.3

조회 수 8012 추천 수 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/881/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수

CentOS 6.5 에서 VirtualBox 4.3 설치후 VirtualBox 구동...

VirtualBox 4.3 Released – Install on RHEL/CentOS/Fedor...

ctime, mtime, atime 다른 점 설명

ZFS 파일에 ACL 설정

ll 명령시 날짜 전체가 보이도록 하기

ModSecurity 로그파일의 사이즈가 너무 큰데 이를 날짜나 ... file

top 화면 내용중 load average와 PRI : priority(우선순위...

hddtemp와 mrtg를 이용한 하드디스크 온도 체크 file

tar 압축을 실수로 디렉토리 생성 안하고 풀었을때 대처법

windows smartctl

HDD Guardian (a graphical user interface for smartctl)

리눅스 벤치마크 프로그램 목록

Adaptec 컨트롤러 StorMan 에러 및 각종 확인 방법

linux 커널 파라메터 수정

특정 데몬의 메모리 점유율 확인하기

make 정리

What are the bandwidth requirements for running a BigB...

스트리밍 서비스 위한 각 회사 와우자,어도비,마이크로 ...

파일비교 명령어 diff 사용법

웹서버 트래픽 시각화 logstalgia

  • l2zeo
  • 2013-05-03
  • 조회 수 6116

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234