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

Detailed installation steps for MySQL 8.0.11

This article shares the installation steps of MyS...

Docker Compose one-click ELK deployment method implementation

Install Filebeat has completely replaced Logstash...

A complete list of meta tag settings for mobile devices

Preface When I was studying the front end before,...

Configure nginx to redirect to the system maintenance page

Last weekend, a brother project was preparing to ...

How to make JavaScript sleep or wait

Table of contents Overview Checking setTimeout() ...

What are the benefits of using // instead of http:// (adaptive https)

//Default protocol /The use of the default protoc...

How to receive binary file stream in Vue to realize PDF preview

Background Controller @RequestMapping("/getP...

Instructions for using the --rm option of docker run

When the Docker container exits, the file system ...

How to modify the scroll bar style in Vue

Table of contents First of all, you need to know ...

Installing Windows Server 2008 operating system on a virtual machine

This article introduces the installation of Windo...

React handwriting tab switching problem

Parent File import React, { useState } from '...

Detailed explanation of MySQL combined query

Using UNION Most SQL queries consist of a single ...