Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (12.7k points)

I want to connect MySQLdb - module. 

I downloaded MySQLdb - module and installed it. 

Be that as it may, when I write (in python interactive shell) :

import MySQLdb

I get 

no module named MySQLdb

At that point I chose to include MySQLdb registry/directory for PYTHONPATH variable. 

I composed (In python interactive shell):

export PYTHONPATH=${PYTHONPATH}:/where/module/lives/

What's more, accordingly I get a syntax error:

invalid syntax: 

export PYTHONPATH^=${PYTHONPATH}:/where/module/lives/

I don't know, what's wrong with the syntax here?

1 Answer

0 votes
by (26.4k points)

If you truly mean that you are typing 

>>> export PYTHONPATH...

in the Python "intractive shell", the syntax error is because that it isn't substantial Python, it is an command(bash) shell proclamation/statement:

$ export PYTHONPATH="$PYTHONPATH:/where/module/lives/"

 $ python

 Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)

 >>> import MySQLdb

 >>>

Wanna become a Python expert? Come and join the python certification course and get certified.

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 4, 2019 in Python by Tech4ever (20.3k points)

Browse Categories

...