I keep getting the following error whenI run my python script,I have the "sudo apt-get install python-mysqldb" installed,i have tried to check if its installed by using "dpkg --get-selections | grep mysql" and check if mysqld is in the PATH,what am I missing here?how to debug this issue?
checking if mysqldb is installed
username@machinename:/local/mnt/workspace/cdit$ dpkg --get-selections | grep mysql
akonadi-backend-mysql install
libmysqlclient-dev install
libmysqlclient18 install
libmysqlclient18:i386 install
libqt4-sql-mysql install
libqt4-sql-mysql:i386 install
mysql-client-core-5.5 install
mysql-common install
mysql-server-core-5.5 install
python-mysqldb install
PATH:-
username@machine:/local/mnt/workspace$ echo $PATH
/pkg/wts/qct/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/pkg/icetools/bin:/pkg/hwtools/bin:/pkg/netscape/bin:/pkg/gnu/bin:/prj/vlsi/tools/bin:/usr/bin/mysql:/usr/sbin/mysqld
ERROR:-
Traceback (most recent call last):
File "script.py", line 40, in <module>
import MySQLdb
ImportError: No module named MySQLdb
To use /usr/local/bin/python
you can add the path to bashrc:
export PATH=/usr/local/bin/python:$PATH
Then source .bashrc
.
Download get-pip.py :
Then run python get-pip.py
.
Finally run sudo pip install your_package
For system wide changes create a file /etc/profile.d/whatever.sh
and add the export line to that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.