MySQL Connector/Python Developer Guide
pip
To verify that a Connector/Python package has been installed
successfully using pip, use the following
command:
$ pip install list
If you have installed the classic interface, you should see an output similar to the following:
Package Version ---------------------------------------- ---------- ... ... mysql-connector-python x.y.z ... ...
If you have installed X DevAPI, you should see an output similar to the following:
Package Version ---------------------------------------- ---------- ... ... mysqlx-connector-python x.y.z ...
The default Connector/Python installation location is
/,
where prefix/pythonX.Y/site-packages/prefix is the location where
Python is installed and X.Y is the
Python version.
The C Extension is installed as
_mysql_connector.so and
_mysqlxpb.so in the
site-packages directory, not in the
mysql/connector and
mysqlx directories for the classic interface
and X DevAPI, respectively.
To verify the C-extension of the classic package is available, run this command:
$ python -c "import mysql.connector; assert mysql.connector.HAVE_CEXT; print(f'C-ext is {mysql.connector.HAVE_CEXT}')"
If no error is returned, the C-extension has been correctly built and installed.
Similarly, to verify the C-extension of the X DevAPI package is available, run this command and see if it returns any errors:
$ python -c "import mysqlx; assert mysqlx.protobuf.HAVE_MYSQLXPB_CEXT; print(f'C-ext is {mysqlx.protobuf.HAVE_MYSQLXPB_CEXT}')"