Mysql学习MySQL-Python安装问题小记

Mysql学习MySQL-Python安装问题小记,第1张

概述介绍《Mysql学习MySQL-Python安装问题小记》开发教程,希望对您有用。

《MysqL学习MysqL-Python安装问题小记》要点:
本文介绍了MysqL学习MysqL-Python安装问题小记,希望对您有用。如果有疑问,可以联系我们。

安装完MysqL-python后import加载模块提示以下错误,MysqL应用

代码如下:
importError: libMysqLclIEnt_r.so.16: cannot open shared object file: No such file or directory

于是Google之,总结一下解决方法:MysqL应用

(1)在MysqL-ython的安装目录下找到site.cfg,将MysqL应用

#MysqL_config = XXXXXXXXXXXXXXXX

注释符号去掉,并填上MysqL_config的地址MysqL应用

(2)将MysqL/lib下所有关于libMysqLclIEnt的so文件软链接到/usr/lib下.MysqL应用

ln -s /usr/local/MysqL/lib/MysqL/libMysqLclIEnt* /usr/libldconfig

这样在加载MysqL应用

import _MysqL

的时候就不会出错了MysqL应用

ubuntu 安装MysqL-python遇到的问题 MysqL应用

版本是python 2.6MysqL应用

使用easy_install 安装MysqL-pythonMysqL应用

easy_install "MysqL-python==1.2.3"
提示:error: Setup script exited with error: command 'gcc' Failed with exit status 1MysqL应用

需要安装 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里面是没有的,我使用新立德软件包管理器安装MysqL应用

libMysqLd-dev
libMysqLclIEnt-dev

安装完成以后需要修改MysqL-python-1.2.3文件夹下面的setup_posix.py中的第26行,MysqL应用

MysqL_config.path = "MysqL_config"改为MysqL_config的路径MysqL应用

whereis MysqL_config查找路径MysqL应用

MysqL_config.path = "/usr/bin/MysqL_config"MysqL应用

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

ubuntu root 权限
sudo -iMysqL应用

安装MysqL-python问题解决 MysqL应用

今天在centos安装MysqL-python,结果报错,报错信息如下:MysqL应用

 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,通过MysqL应用

sudo yum install MysqL-devel.x86_64MysqL应用

再次安装成功MysqL应用

[yunpeng.jiangyp@v010105 ~]$ pip install MysqL-pythonDownloading/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,-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-pythonCleaning up...

《MysqL学习MysqL-Python安装问题小记》是否对您有启发,欢迎查看更多与《MysqL学习MysqL-Python安装问题小记》相关教程,学精学透。内存溢出PHP学院为您提供精彩教程。

总结

以上是内存溢出为你收集整理的Mysql学习MySQL-Python安装问题小记全部内容,希望文章能够帮你解决Mysql学习MySQL-Python安装问题小记所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/1155421.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-01
下一篇2022-06-01

发表评论

登录后才能评论

评论列表(0条)

    保存