Im still very much learning python and all the different ways to use 3rd party modules. I have installed https://pypi.python.org/pypi/mysqlclient which was recommended here Python 3 and MySQL
I believe i installed the package correctly
D:\install\python modules>python -m pip install mysqlclient-1.3.6-cp34-none-win_amd64.whl
Unpacking d:\install\python modules\mysqlclient-1.3.6-cp34-none-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient
Cleaning up...
weird thing is when i try and import the module mysqlclient I get the below
D:\install\python modules>python
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysqlclient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'mysqlclient'
I checked the homepage https://github.com/PyMySQL/mysqlclient-python and I couldnt find any examples on how to use this module. I am quite confused, have I just majorly missed the boat here?
The PyMySQL project includes a user guide. It’s not so easy to find this guide (there are no obvious links) and to add to the confusion, the module name does not correspond with the package name. To use it, you need:
import MySQLdb
The MySQLdb
module implements PEP 249 - the Python Database API Specification for accessing databases. When using this API, Python code should be more portable across different relational database management systems.
It’s not recommended to use the _mysql
module (which is also included in this package). It’s not portable and it works at a lower level of abstraction (implementing the MySQL C API).
Here are two tutorials that you might find useful. I’ve used them with the original MySQLdb package in Python 2 but the API is the same (as defined by PEP-249). They both contain practical examples of database access (reading and writing data) and I found them to be better for getting started with the API than the official documentation.