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/c85/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
27 CentOS 5.6 + NginX 0.8.54 + Django 1.3 (FastCGI) + Pyt... ADMINPLAY 2014-03-28 6228
26 gcc Library 경로 지정 ADMINPLAY 2014-04-07 6075
25 Linux Command 로 Mysql table drop 방법 ADMINPLAY 2014-04-07 5776
24 CentOS 자동로그인 설정 ADMINPLAY 2014-04-14 8900
23 CentOS Linux Remote Desktop 에서 로그인 화면보기 ADMINPLAY 2014-04-14 7876
22 SCM - 캐시 서버 구축 (Squid in Linux) ADMINPLAY 2014-04-27 8313
21 SSL 패스워드 삭제 하기 ADMINPLAY 2014-04-27 5445
20 vi 이미 읽은 파일의 인코딩 변경하기 ( euc-kr 로 encodi... ADMINPLAY 2014-05-31 7004
19 How to Enable EPEL Repository for RHEL/CentOS 6/5 ADMINPLAY 2014-06-13 9612
18 [Linux] Proxy 서버 설정하기 ADMINPLAY 2014-06-17 17206
17 Zabbix 웹서비스 모니터링 ADMINPLAY 2014-07-07 8349
16 Hamlet 은 “웹서버 모니터링 오픈소스 솔루션” 입니다. ADMINPLAY 2014-07-07 6794
15 cacti plugin thold 설치 ADMINPLAY 2014-07-07 8172
14 원격데스크톱(RDP) 클라이언트 접속기록(Log) 삭제하기 file ADMINPLAY 2014-07-14 7713
13 [우분투] 노하드 서버 설정하기 ADMINPLAY 2014-08-05 20251
12 Dell OMSA 설치 및 이용방법 ADMINPLAY 2014-08-13 51942
11 [CentOS] sshfs - 리눅스 윈도우간 데이터 전송을 편리하게 file ADMINPLAY 2014-09-21 9513
10 Install 3ware (LSI) 9690SA SCSI RAID Controller VIB On... file ADMINPLAY 2014-10-09 7095
9 [맥] 커맨드 라인에서 CD/DVD 꺼내기 ADMINPLAY 2014-10-14 7153
8 [linux][명령어 백그라운드 실행] ADMINPLAY 2015-05-20 14834

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234