Connect mysql database with django - python

I am a begginer in django, i try to connect mysql database with django but when i write python manage.py migrate in cmd i see this error: mysqlclient 1.3.13 or newer is required yo have 0.9.3
so i decide to upgrade mysql client using this command:pip install mysqlclient --upgrade and i get this output:
https://i.stack.imgur.com/bq7Jn.jpg
https://i.stack.imgur.com/nYGSQ.jpg
https://i.stack.imgur.com/u8wzN.jpg
How to fix it?

Try to install using wheel
pip install wheel
Download the mysqlclient from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
for python 3.X
pip install mysqlclient-1.3.8-cp36-cp36m-win_amd64.whl
for python 2.x
pip install mysqlclient-1.3.8-cp27-cp27m-win_amd64.whl

this error commonly occurs in windows if not install visual studio and other tools.if you work in Django + windows then install visual studio latest version.

Related

How to install mysql in my Django project using pip or any other tool in python 3.7

I've build a django project using python 3.7, Now I'm trying to deploy my project on Google App engine, and trying to use mysql locally for testing. After going through multiple question/answers/documentation still I'm unable to install mysql correctly.
I tried following options:
pip install mysqlclient
brew install mysql-connector-c
pip3 install http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip
pip install mysql-connect-python
pip install pymysql
But none of the above is working for me.

How to fix mysql django connection on mac OS?. I already installed mysqlclient but "Did you install mysqlclient?" Error displayed

I am setting a new Django 2.2 project with MySQL 8.0 on mac. I already installed mysqlclient and mysql-connector-python. When I hit python manage.py makemigrations this displayed:
"django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?"
I am using python 3.7.
How can I solve this problem?
I already installed pip install mysqlclient mysql-connector-python
Will not work for Python 3.7
import pymysql
pymysql.install_as_MySQLdb()
You need to install mysqlclient globally and in your project. I think you should install once globally on your pc and try

update PostgreSQL client library to 9.1

I am installing psycopg2 using this command:
pip3 install psycopg2
But the output is:
./psycopg/psycopg.h:30:2: error: #error "Psycopg requires PostgreSQL
client library (libpq) >= 9.1"
My pg_config version: pg_config --version is PostgreSQL 8.4.20. How to upgrade PostgreSQL client library? I am searching from Google, but no method to guide me. Python version: 3.5.0.
I guess you need to install it according to these instructions - https://www.postgresql.org/download/linux/redhat/.
Upgrade pip version 7.1.2 to version 18.1 solve this problem:
pip3 install --upgrade pip
Execute this command to install psycopg2:
pip3 install psycopg2

Cannot install flask-mysqldb

I've been trying to install flask-mysqldb using pip install flask-mysqldb, but every time I try it gives me an error that says :
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe' failed with exit status 2
I've looked around a lot and no answer works for me. I searched the file in https://www.lfd.uci.edu/~gohlke/pythonlibs/ but its not there.
I am on Windows 7 x64.
Of course you can not find whl for flask-mysqldb, but you can find mysqlclient.
Download suitable version for you platform from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Then, e.g. pip install mysqlclient-1.3.13-cp27-cp27m-win32.whl, depends what you download.
Finally, pip install flask-mysqldb again, this will work for you.
the same issue/problem I've also received,
That is flask_mysqldb 'no module'
first of all flask_mysqldb isn't installed through pip,
You have to install a suitable version for mysqlclient
for me it worked
I'm using window 10 having python3.8 installed....... to rectfiy the error use the follwing procedure:
click on the link
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and select mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl (python3.8 a suitable version for me) download it
then search for the directory where downloaded ..... and then through command prompt type
pip install mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl
and then
pip install flask_mysqldb
and done
I had the same problem
I was using python 3.8 and it's not supported by this package.
https://flask-mysqldb.readthedocs.io/en/latest/ : Flask-MySQLdb is compatible with and tested on Python 2.7, 3.5, 3.6 and 3.7
I recreated a virtual environment with python 3.7 and it all worked.
installing above must be made
For Windows
install pip install wheel
after go to on your browser ' https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python '
find the appropriate package for the python version and download.
and copy that file to C:\Users<your-computer-name> .
go to cmd again and write here pip install flask-mysqldb

Unable to install a Library using PIP

So I'm trying to follow a tutorial to connect to an SQL database, using Connector/Python.
I have to import it, obviously:
import mysql.connector
So I tried pip install mysql in the terminal.
This is what I got:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/g6/yrxcmygn3ls375rm9rh3p86r0000gn/T/pip-build-a0d0rzdl/MySQL-python/
What I've tried from looking up on Google:
pip install --upgrade setuptools
pip install ez_setup
pip install unroll
easy_install -U setuptools
Nothing worked
Thanks
MySQL-Python is not available for Python 3, you may consider using MySqlClient which is a fork of the MySQL-python interface for the MySQL database.
Before installing this connector, make sure MySQL (or MariaDB) is installed.
On Linux, you also need the "devel" packages. See: https://stackoverflow.com/a/7461662/1513933
On Windows, you may be interested in the unofficial Windows binaries.
To install, an application, the best practices is to use a virtualenv.

Categories