[PYTHON] When I try to install mysqlclient with Django, I get error: command'gcc' failed with exit status 1.

environment

macOS Catalina 10.15.4

I got an error!

newly

python3 -m venv env

After building a virtual environment with

pip install mysqlclient

When I run, I run into a title error.

First of all, there is someone who hits the same error first! When I think about it, it seems that there are two patterns, and this is the first case.

Cannot install Pillow in macOS Mojave using brew #3438

This person seems to have given an error when trying to install pillow with pip, and the cause seems to be mojave. So the solution is

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

When I ran, I stopped coming out! And that. However, in my case, following these steps did not resolve the error. It seems that this procedure is not possible for those who have updated to Catalina in the first place.

I will write it because there may be some people who will work with this pattern.

This is the second case.

Pip install cannot be done (error: command'gcc' failed with exit status 1)

Now download and install Xcode and then try again

pip install mysqlclient

Run.

Then ld: library not found for -lssl linker command failed with exit code 1 (use -v to see invocation) And the error changes. Apparently it's because I didn't go through the path

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

Execute.

After that, I tried to install it again and it succeeded. Yeah, I was worried about it, but I'm glad I was able to solve it safely.

Recommended Posts

When I try to install mysqlclient with Django, I get error: command'gcc' failed with exit status 1.
I get an error when trying to install maec 4.0.1.0 with pip
When I try to connect to MySQL with mysql-connector-python, I cannot connect with the error "SSL connection error: SSL_CTX_set_tmp_dh failed"
When I get an error with PyInstaller
I failed to install django with pip, so a reminder of the solution
pip install ○○○ error Command errored out with exit status 1:
When I try to import pandas on macOS I get the error No module named'_bz2'
I want to get an error message in Japanese with django Password Change Form
I get an error when I try to raise Python to 3 series using pyenv on Catalina
When I try to connect django and postgresql with Docker, I get the error "django.db.utils.OperationalError: could not translate host name" db "to address: Name or service not known"
When I try to push with heroku, it doesn't work
Problem that pip install cannot be done with pyenv + Yosemite (error: command'clang' failed with exit status 1)
[Solution] When I try to connect to CloudSQL with GAE, I get an ImportError only when using dev_appserver.
Solution memo when "ERROR: Command errored out with exit status 1:" is displayed in pip install hogehoge
A memorandum when I tried to get it automatically with selenium
When I get an error with Pylint in Atom on Windows
How to get started with Django
When WSL Distro fails to start (error: "WslRegisterDistribution failed with error: 0x800706be.")
When I import TensorFlow to Python, I get "Import Error: DLL load failed: The specified module cannot be found."
I want to get angry with my mom when my memory is tight
I got an error when trying to install Xgboost and its solution
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
When I try to upgrade pip, I get an infinite loop after failing to upgrade
I get an error with import pandas.
Step notes to get started with django
I tried to get started with Hy
I was addicted to pip install mysqlclient
I want to pip install with PythonAnywhere
What to do if you get an error when installing python with pyenv
[Python] What to check when you get a Unicode Decode Error in Django
I got an error when saving with OpenCV
The easiest way to get started with Django
When I get a chromedriver error in Selenium
[Django] How to resolve errors when installing mysqlclient
I wanted to install Python 3.4.3 with Homebrew + pyenv
I tried to get CloudWatch data with Python
I get a UnicodeDecodeError when running with mod_wsgi
I get an error with all yum commands
Error when trying to install psycopg2 in Python
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an Import Error when importing matplotlib with Jupyter
I got an error when pip install pandas on Mac, so I dealt with it
I tried to create a table only with Django
[First API] Try to get Qiita articles with Python
I tried to get started with blender python script_Part 01
When you want to filter with Django REST framework
I get an error when I put opencv in pyautoGUI
I get an error when trying meinheld + WebSocket + mongodb
A memorandum when an error occurs with pip install
Things to do when you start developing with Django
Things to watch out for when migrating with Django
What I did to get started with Linux commands
I got an error when using Tensorboard with Pytorch
I got an error when pip install tweepy on macOS Sierra, so I dealt with it
When I run pipenv install <package name>, I get a "No matching distribution found for <package name>" error.
When I tried to install Ubuntu 18.04, "Initramfs unpacking failed: Decoding failed" was displayed and the startup failed.
What to do if you get an Undefined error when trying to use pip with pyenv
I want to improve efficiency with Python even in an experimental system (4) Use ser.close () when an error is thrown using try syntax