亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

MySQL-Python安裝問題小記

系統 1521 0

安裝完mysql-python后import加載模塊提示以下錯誤,

復制代碼 代碼如下:

ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

于是google之,總結一下解決方法:

(1)在mysql-ython的安裝目錄下找到site.cfg,將

          
#mysql_config = XXXXXXXXXXXXXXXX

        

注釋符號去掉,并填上mysql_config的地址

(2)將mysql/lib下所有關于libmysqlclient的so文件軟鏈接到/usr/lib下。

          
ln -s /usr/local/mysql/lib/mysql/libmysqlclient* /usr/lib
ldconfig

        

這樣在加載

          
import _mysql

        

的時候就不會出錯了

ubuntu 安裝mysql-python遇到的問題

版本是python 2.6

使用easy_install 安裝MySQL-python

easy_install "MySQL-python==1.2.3"
提示:error: Setup script exited with error: command 'gcc' failed with exit status 1

需要安裝 python-devel
sudo apt-get install python-dev
#apt-get install python-devel
再使用easy_install 安裝就可以

如果使用python setup.py 安裝,提示mysql_config找不到
EnvironmentError: mysql_config not found
需要安裝下面2個開發包,需要注意的是apt-get里面是沒有的,我使用新立德軟件包管理器安裝

libmysqld-dev
libmysqlclient-dev

安裝完成以后需要修改MySQL-python-1.2.3文件夾下面的setup_posix.py中的第26行,

mysql_config.path = "mysql_config"改為mysql_config的路徑

whereis mysql_config查找路徑

mysql_config.path = "/usr/bin/mysql_config"

再使用
python setup.py build
python setup.py install
就可以

ubuntu root 權限
sudo -i

安裝MySQL-python問題解決

今天在centos安裝MySQL-python,結果報錯,報錯信息如下:

            
 Running command /home/yunpeng.jiangyp/sys/python/bin/python -c "import setuptools;__file__='/home/admin/jyp/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-MH5Aya-record/install-record.txt
 running install
 running build
 running build_py
 copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
 running build_ext
 building '_mysql' extension
 gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/home/yunpeng.jiangyp/sys/python/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-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv
 _mysql.c:44:23: error: my_config.h: No such file or directory
 _mysql.c:46:19: error: mysql.h: No such file or directory
 _mysql.c:47:26: error: mysqld_error.h: No such file or directory
 _mysql.c:48:20: error: errmsg.h: No such file or directory
 _mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL'
 _mysql.c:102: error: expected specifier-qualifier-list before ‘MYSQL_RES'
          

google找到答案(http://stackoverflow.com/questions/13044201/install-mysql-python-return-error-in-centos),需要先安裝mysql-devel.x86_64,通過

sudo yum install mysql-devel.x86_64

再次安裝成功

            
[yunpeng.jiangyp@v010105 ~]$ pip install MySQL-python
Downloading/unpacking MySQL-python
 Running setup.py egg_info for package MySQL-python
 
Installing collected packages: MySQL-python
 Running setup.py install for MySQL-python
 building '_mysql' extension
 gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/home/yunpeng.jiangyp/sys/python/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-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv
 gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_mysql.so
 
Successfully installed MySQL-python
Cleaning up...
          

更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美一区二区在线观看免费网站 | 狠狠综合欧美综合欧美色 | 亚洲欧美日韩一区 | 国内精品免费网站牛牛 | 天天干天天色天天 | 九月丁香婷婷亚洲综合色 | 国产日韩精品欧美一区色 | 国产欧美日韩综合二区三区 | 黄毛片免费| 日韩午夜小视频 | 午夜视频欧美 | 99精品国产兔费观看66 | 精品视频一区二区三区在线播放 | 国产精品视频免费一区二区三区 | 亚洲一区二区三区四区热压胶 | 一个色综合亚洲色综合 | 国产精品免费大片 | 9999毛片免费看 | 久草在线视频精品 | 久青草免费视频 | 中文字幕在线不卡视频 | 国产一区二区不卡 | 日产精品一区二区 | 欧美乱理伦另类视频 | 日韩精品欧美亚洲高清有无 | 成人高清视频在线观看大全 | 久久久在线视频精品免费观看 | 午夜主播国产福利视频在线 | 97久久精品人人澡人人爽 | 中文字幕久久久久 | 亚洲一区二区三区免费在线观看 | 一级特黄特黄的大片免费 | 一本久道久综合久久鬼色 | 久久久中文字幕日本 | 乱人伦视频69 | 欧美精品久久久久久久影视 | 亚洲青色在线 | 欧美在线一区二区三区精品 | 久久精品亚洲欧美va | 久久综合噜噜激激的五月天 | 久久亚洲这里只有精品18 |