I pulled mysql-connector-python
code and when I run python ./setup.py build
I get the following error:
Unable to find Protobuf include directory.
pip install Protobuf
was useless
How can I solve this problem?
Installation: To install Python-mysql-connector module, one must have Python and PIP, preinstalled on their system. To check if your system already contains Python, go through the following instructions: Open the Command line(search for cmd in the Run dialog( + R).
We recommend that you use PIP to install "MySQL Connector". PIP is most likely already installed in your Python environment.
I found that this error occurs since version 2.2.3. You can avoid this issue using version 2.1.6.
pip install mysql-connector==2.1.6
try above.
As of 2.2.3, Connector/Python uses a C++ extension that interfaces with a MySQL server with the X plugin enabled, using Protobuf as data interchange format.
So, you need to set up where Protobuf is installed on your system (the library, include and protoc binary paths).
Requirements
Installation
You have two options when using pip + pypi:
1) Set environment variables for MYSQLXPB_PROTOBUF_INCLUDE_DIR
, MYSQLXPB_PROTOBUF_LIB_DIR
and MYSQLXPB_PROTOC
.
2) Add --install-option
to set these options when using pip:
shell> python install mysql-connector --install-option='--with-protobuf-include-dir=<path>' --install-option='--with-protobuf-lib-dir=<path>' --install-option='--with-protoc=<path>'
Important: Keep in mind that 2.2.3 is a development release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With