mysql - Can MySQLdb be Accessed From IDLE3 With Python Version 3.4? -


i experimenting idle3 connect mysql database. line import mysqldb generates error message:

importerror: no module named 'mysqldb'

i using linux (ubuntu 14.04)

python exists in 2 versions on computer. 1 version: python 2.7.6. ability import "mysqld" works version of python.

the other version python 3.4.0. ability import "mysqld" not work version.

while knew there 2 versions, unaware entering text "python" gives python version 2.7.6. intent, idle3 work python version 3.4.0. realized oversight based on clues provided holdenweb in response below.

based on further internet searching, solution exist ubuntu @ least.

the issue appears idle , python aren't using same environment. variable sys.path contains list of directories python interpreter search libraries has been asked import. if execute following code in plain python interpreter , in idle should see differences:

import sys print "\n".join(sys.path) 

you can find out directory mysqldb library lives in importing , doing

print mysqldb.__file__  

if directory doesn't appear in sys.path need add it. usual way of doing setting pythonpath environment variable. can find out how set particular environment in python documentation.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -