Mac installation mysqlclient process analysis

Mac installation mysqlclient process analysis

Try installing via pip in a virtual environment:

pip install mysqlclient

Then an error is reported: OSError: mysql_config not found

Found the official document https://github.com/PyMySQL/mysqlclient-python, explaining that another module needs to be installed before installation:

brew install mysql-connector-c

But the error:

Check the error message and install mysql-connector-c before

brew unlink mysql

But continue to install or error:

Check the official instructions, it turns out that under macOS, you need to change the value in mysql_config

# on macOS, on or about line 112:
# Create options 
libs="-L$pkglibdir"
libs="$libs -l "

Change to

# Create options 
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"

Next is easy, directly

which mysql_config

Find the file path, move to that path, modify the content with vim, exit and re-execute

pip install mysqlclient

It succeeded.

In fact, there are other modules for connecting to MySQL under Python, such as pymysql, etc., which are not so troublesome to install on Mac.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL5.7+ MySQL Workbench installation and configuration method graphic tutorial under MAC
  • MySQL 8.0.11 MacOS 10.13 installation and configuration method graphic tutorial
  • Download MySQL 5.7 and detailed installation diagram for MySql on Mac
  • What to do if you forget the initial password when installing MySQL on Mac
  • Detailed installation and configuration of MySql on Mac
  • Complete steps to install mysql5.7 on Mac (with pictures and text)

<<:  Mini Program to Implement the Complete Shopping Cart

>>:  SELinux Getting Started

Recommend

Research on the value of position attribute in CSS (summary)

The CSS position attribute specifies the element&...

CSS syntax for table borders

<br /> CSS syntax for table borders The spec...

Understanding JavaScript prototype chain

Table of contents 1. Understanding the Equality R...

Detailed steps to install MySQL 5.6 X64 version under Linux

environment: 1. CentOS6.5 X64 2.mysql-5.6.34-linu...

Implementation of static website layout in docker container

Server placement It is recommended to use cloud s...

Invalid solution when defining multiple class attributes in HTML

In the process of writing HTML, we often define mu...

The simplest form implementation of Flexbox layout

Flexible layout (Flexbox) is becoming increasingl...

Vue implements image dragging and sorting

This article example shares the specific code of ...

TortoiseSvn Little Turtle Installation Latest Detailed Graphics Tutorial

There were always problems when installing tortoi...

MySQL Series 14 MySQL High Availability Implementation

1. MHA ​By monitoring the master node, automatic ...

Solution to the problem of invalid width setting for label and span

By default, setting width for label and span is in...