Skip to content

python 및 MySQLdb를 소스 컴파일 후 아래와 같은 에러가 날 경우에

[user@server ~]$ python
Python 2.6.2 (r262:71600, Jul 15 2009, 16:16:00)
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
  File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in <module>
  File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
  File "build/bdist.linux-i686/egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory


/etc/profile에서 환경변수 변경

[root@server ~]$ vi /etc/profile
[root@server ~]$ vi /etc/profile
LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql/
export LD_LIBRARY_PATH
[root@server ~]$ source /etc/profile


혹. cron을 이용해서 프로그램을 실행할 경우에는 위와 같이 하더라도 오류가 발생한다.
그럴 경우엔.. crontab 내용 상단에 LD_LIBRARY_PATH를 설정하면 된다..


아래의 굵은 글자는 mysql 경로에 따라 달라질 수 잇음.
[user@server ~]$ crontab -e
[user@server ~]$ crontab -e
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/mysql/lib/mysql/
...
0 * * * * python /home/user/test.py

crontab restart.
profile

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

엮인글 :
http://adminplay.com/277901/611/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수
347 SSL 패스워드 삭제 하기 ADMINPLAY 2014-04-27 5346
346 SCM - 캐시 서버 구축 (Squid in Linux) ADMINPLAY 2014-04-27 8229
345 CentOS Linux Remote Desktop 에서 로그인 화면보기 ADMINPLAY 2014-04-14 7797
344 CentOS 자동로그인 설정 ADMINPLAY 2014-04-14 8826
343 Linux Command 로 Mysql table drop 방법 ADMINPLAY 2014-04-07 5696
342 gcc Library 경로 지정 ADMINPLAY 2014-04-07 6007
341 CentOS 5.6 + NginX 0.8.54 + Django 1.3 (FastCGI) + Pyt... ADMINPLAY 2014-03-28 6163
340 CentOS 6.5 + Python2.7 + MySQL_Python-1.2.3 ADMINPLAY 2014-03-28 7943
» python과 mysql 연동시 libmysqlclient_r.so.* 에러가 날 ... ADMINPLAY 2014-03-27 5518
338 python mysql connector 설치 및 SQLAachemy 연동 ADMINPLAY 2014-03-27 7875
337 SVN 클라이언트 명령어 ADMINPLAY 2014-03-18 7429
336 CentOS 6.X GUI 로그인 화면에서 로그인 했던 계정 리스트... ADMINPLAY 2014-03-05 16647
335 OS X 매버릭스가 NAS, 윈도우 PC 등 SMB 장비에 연결하지 ... ADMINPLAY 2014-03-04 6735
334 OS X 10.9 매버릭스의 기본 파일공유 프로토콜은 AFP가 아... ADMINPLAY 2014-03-04 10984
333 telnet 과 ssh 의 차이점 ADMINPLAY 2014-03-01 6454
332 vimrc 설정 file ADMINPLAY 2014-03-01 6082
331 Linux 마우스 휠 방향 바꾸기 (mac 처럼 마우스 휠 바꾸기) ADMINPLAY 2014-02-27 11840
330 디스크 UUID 변경후 하드부팅정보 수정하기 ADMINPLAY 2014-02-26 21008
329 linux daemon (리눅스 데몬 설명) ADMINPLAY 2014-02-26 647768
328 Strace - 시스템콜과 신호 추적 file ADMINPLAY 2014-02-25 6043

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234