Skip to content

Instantly share code, notes, and snippets.

@shibli049
Last active April 23, 2023 05:48
Show Gist options
  • Save shibli049/00f8bf3843ab615474da to your computer and use it in GitHub Desktop.
Save shibli049/00f8bf3843ab615474da to your computer and use it in GitHub Desktop.
Install mysqlclient for python3
#sudo pip3 install mysqlclient fails with mysql_config not found
sudo apt-get install libmysqlclient-dev
#without pip3 it will not going to work for python3
sudo pip3 install mysqlclient
# to run django migration
python3 manage.py migrate
@Ggrabowsky
Copy link

Thanks, it works!

@ChyiYaqing
Copy link

python3 manage.py migrate what's mean???

@shibli049
Copy link
Author

@ChyiYaqing : I forgot to mention, this command is to run Django migration. added in the file comment.

@taojunxin
Copy link

Thanks!

@shamaru001
Copy link

thanks you so much!

@farzadab
Copy link

Thanks!
But it seems like I need yet another package on Ubuntu:

sudo apt-get install -y python3-mysqldb

(The pip install command does work without it, but I still get an error when running Django commands like migrate)

@shaharyogev
Copy link

Thanks #farzadab
This was the code that work for me -
sudo apt-get install -y python3-mysqldb

@kerick-jeff
Copy link

Thanks. Saved my day

@sandzone
Copy link

Perfect. It works now!

@andreymeretsky
Copy link

thanks a lot! installing python packages always like a dancing with a tambourine

@vkutuev
Copy link

vkutuev commented Oct 6, 2018

Thanks!

@m-okhravi
Copy link

i install MySQL with "sudo apt-get install -y python3-mysqldb" and it install but when I go to python3 and import MySQL return error "no module name MySQL"
my os is ubuntu, how I can fix it?

@revan-more
Copy link

how to install mysqlclient this install time its getting error

No matching distribution found for setup.py like message it will through

@anasshah94
Copy link

Thanks it works for me

@tanjuntao
Copy link

thanks! it works

@samirjemaa
Copy link

same probleme
did you install mysqlclient?

@revan-more
Copy link

revan-more commented May 12, 2021 via email

@ioszhuk
Copy link

ioszhuk commented May 20, 2021

recommend read and do this: https://pypi.org/project/mysqlclient/

@rhm539
Copy link

rhm539 commented Aug 8, 2021

thanks

@HrushikeshKoppula
Copy link

++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment