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/538/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수
등록된 글이 없습니다.

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234