modulenotfounderror no module named 'mysqldb' python 3

Ads
 

modulenotfounderror no module named 'mysqldb' python 3

Hi,

I have a python program and it is connecting to MySQL database.

But it throws following error:

modulenotfounderror no module named 'mysqldb' python 3

How to resolve this?

Thanks

View Answers

February 20, 2018 at 10:41 AM

HI,

This error is coming because mysqldb library is not installed on your python.

Error:

ModuleNotFoundError: No module named 'MySQLdb'

You can run mysqldb with following command to resolve this:

conda install MySQL-python

or

pip install MySQL-python

Thanks


February 20, 2018 at 10:43 AM

HI,

Here is the installation process output:

(tensorflow) D:\ClientServers\dermot\2018>conda install MySQL-python
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.8
  latest version: 4.4.10

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: C:\Users\user\AppData\Local\conda\conda\envs\tensorflow

  added / updated specs:
    - mysql-python


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    mysql-python-1.2.5         |           py27_0         764 KB
    certifi-2018.1.18          |           py27_0         144 KB
    setuptools-38.4.0          |           py27_0         541 KB
    pip-9.0.1                  |   py27hdaa76b4_4         2.4 MB
    wincertstore-0.2           |   py27hf04cefb_0          13 KB
    vc-9                       |       h7299396_1           3 KB
    vs2008_runtime-9.00.30729.1|       hfaea7d5_1        1017 KB
    python-2.7.14              |      h8c3f1cb_23        20.6 MB
    wheel-0.30.0               |   py27ha643586_1          84 KB
    ------------------------------------------------------------
                                           Total:        25.4 MB

The following NEW packages will be INSTALLED:

    mysql-python:   1.2.5-py27_0
    vs2008_runtime: 9.00.30729.1-hfaea7d5_1

The following packages will be UPDATED:

    certifi:        2017.7.27.1-py35hbab57cd_0 --> 2018.1.18-py27_0
    pip:            9.0.1-py35h691316f_4       --> 9.0.1-py27hdaa76b4_4
    setuptools:     36.5.0-py35h21a22e4_0      --> 38.4.0-py27_0
    wheel:          0.29.0-py35hdbcb6e6_1      --> 0.30.0-py27ha643586_1
    wincertstore:   0.2-py35hfebbdb8_0         --> 0.2-py27hf04cefb_0

The following packages will be DOWNGRADED:

    python:         3.5.4-hc495aa9_21          --> 2.7.14-h8c3f1cb_23
    vc:             14-h2379b0c_2              --> 9-h7299396_1

Proceed ([y]/n)? y


Downloading and Extracting Packages
mysql-python 1.2.5: ################################################### | 100%
certifi 2018.1.18: #################################################### | 100%
setuptools 38.4.0: #################################################### | 100%
pip 9.0.1: ############################################################ | 100%
wincertstore 0.2: ##################################################### | 100%
vc 9: ################################################################# | 100%
vs2008_runtime 9.00.30729.1: ########################################## | 100%
python 2.7.14: ######################################################## | 100%
wheel 0.30.0: ######################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Thanks

Ads









Related Tutorials/Questions & Answers:
NameError: global name 'xrange' is not defined in Python 3
NameError: global name 'xrange' is not defined in Python 3  Hi, I am running a program in Python 3 and its throwing following error: NameError: global name 'xrange' is not defined in Python 3 How to solve NameError: global
ImportError: No module named scipy.ndimage - Solved
ImportError: No module named scipy.ndimage - Solved  Hi, How to solve following error: ImportError: No module named scipy.ndimage This error...;Hi, Here is full log of install python-scipy: File "1.py", line 3, in <
Advertisements
attributeerror 'dict' object has no attribute 'iteritems' python 3
attributeerror 'dict' object has no attribute 'iteritems' python 3  Hi, Another error in python program: attributeerror 'dict' object has no attribute 'iteritems' python 3 How to solve this? Thanks   Hi, In Python
Module in Flex 3
Module in Flex 3:- In the Flex 3,  Modules are dynamically loadable SWF... if application requires to load these module and they can be unloaded when application no longer needs a module.  These modules can not be run independently
How to run external command in Python?
, In Python you have to use the sub-process. The subprocess module is very useful...How to run external command in Python?  Hi, I am writing an application in Python and there is requirement of calling the external command from
ModuleManager for load or unload module in Flex 3
Load module with the help of ModuleManager class:- In this example, we will used module manager to load and unload modules in the application. It is loaded module with the help of  IModuleInfo interface by using the ModuleManager
Deep Learning with Python Programming
Deep Learning with Python Programming  Hi, How to learn Deep Learning with Python Programming? Thanks   Deep Learning with Python Python... Leaning, Python stands out as it provides many libraries to develop many deep
ANSI Color Codes with Python
ANSI Color Codes with Python   Use ANSI codes to play with colors and styles. Create a program that will spit out a user inputted string in a color, style, or background color that they can choose. To do this, you'll need
Version of cocoon>cocoon-python dependency
List of Version of cocoon>cocoon-python dependency
Version of drools>drools-python dependency
List of Version of drools>drools-python dependency
Hibernate named queries
Hibernate named queries  Hi, What is named queries in Hibernate? Thanks
3
Spring 3
Spring 3  Hi I want to know how to write code Spring 3 for registration and login pages with help of data bse.Please help me I am new to Spring
a class named Transactions
a class named Transactions  Write this java code for me: a class named Transactions that holds the memo and the amount of a transaction. Prompt the user for the number of transactions and create a new Transaction object
Design a class named account
Design a class named account  The class contains: § An int data field named id for the account (default 0). § A double data field named balance for the account (default 0.0) § A double data field named annualInterestRate
Version of plexus>plexus-python-factory dependency
List of Version of plexus>plexus-python-factory dependency
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Database named studentinfo
Database named studentinfo  1.create design of studentinfo using swing component 2.Create a database named student info. 3.create a table that stores all the details from the form,application of basic Normalization is required
Named ? SQL query in hibernate
Named ? SQL query in hibernate  What is Named SQL query in hibernate?   You can put all the HQL into the XML mapping file rather than putting the sql queries to various places in between code. sample.hbm.xml <
Maven Dependency cocoon-python >> 2.1.3
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.3 in your project
Maven Dependency cocoon-python >> 2.1.4
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.4 in your project
Maven Dependency cocoon-python >> 2.1.5.1
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.5.1 in your project
Maven Dependency cocoon-python >> 2.1.6
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.6 in your project
Maven Dependency cocoon-python >> 2.1.7
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.7 in your project
Maven Dependency cocoon-python >> 2.1.8
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.8 in your project
Maven Dependency drools-python >> 2.0
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version2.0 in your project
Maven Dependency drools-python >> 20040622.175041
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040622.175041 in your project
Maven Dependency drools-python >> 20040623.065114
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040623.065114 in your project
Maven Dependency drools-python >> 20040630.215721
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040630.215721 in your project
Maven Dependency drools-python >> 20040701.153744
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040701.153744 in your project

Ads