After installing Mysql-python, the Import loading module prompts the following error.
Copy Code code as follows:
Importerror:libmysqlclient_r.so.16:cannot open Shared object file:no such file or directory
So Google's, summed up the solution:
(1) Find site.cfg under the Mysql-ython installation directory and
#mysql_config = xxxxxxxxxxxxxxxx
The annotation symbol is removed and the Mysql_config address is filled in
(2) The Mysql/lib all about the libmysqlclient of so file soft link to/usr/lib under.
Ln-s/usr/local/mysql/lib/mysql/libmysqlclient*/usr/lib
ldconfig
This is loaded
Import _mysql
, there's no mistake.
Problems with Ubuntu installation Mysql-python
Version is Python 2.6
Use Easy_install to install Mysql-python
Easy_install "mysql-python==1.2.3"
Hint: Error:setup script exited with Error:command ' GCC ' failed with exit status 1
Need to install Python-devel
sudo apt-get install Python-dev
#apt-get Install Python-devel
Then use the Easy_install installation to
If you use the Python setup.py installation, you are prompted that Mysql_config cannot find
Environmenterror:mysql_config not found
Need to install the following 2 development kits, note that there is no apt-get inside, I use the new Ted Package Manager installation
Libmysqld-dev
Libmysqlclient-dev
After the installation is complete, you need to modify line 26th in the setup_posix.py below the mysql-python-1.2.3 folder.
Mysql_config.path = "Mysql_config" changed to Mysql_config path
Whereis Mysql_config Lookup Path
Mysql_config.path = "/usr/bin/mysql_config"
Re-use
Python setup.py Build
Python setup.py Install
Will be
Ubuntu Root Permissions
Sudo-i
Installation Mysql-python Problem Solving
Today in CentOS installation Mysql-python, the results of the error, the error message is as follows:
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_in fo= (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 Directo Ry _mysql.c:48:20:error:errmsg.h:no such file or directory _mysql.c:88:error:expected specifier-qualifier-list befo Re ' MYSQL ' _mysql.c:102:error:expected specifier-qualifier-list before ' mysql_res '
Google finds the answer (Http://stackoverflow.com/questions/13044201/install-mysql-python-return-error-in-centos), Need to install mysql-devel.x86_64 first, through
sudo yum install mysql-devel.x86_64
Successful installation again
[yunpeng.jiangyp@v010105 ~]$ pip install Mysql-python downloading/unpacking mysql-python Running setup.py egg_info for P Ackage Mysql-python Installing collected Packages:mysql-python Running setup.py install for Mysql-python building ' _m Ysql ' extension gcc-pthread-fno-strict-aliasing-g-o2-dndebug-g-fwrapv-o3-wall-wstrict-prototypes-fpic-dversio n_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 Success Fully installed Mysql-python cleaning up ...