Install mysql with django on mac os
I am trying to install mysql server with my django app, but I am having trouble installing it correctly.
I used brew install mysql
to install mysql server.
Then I used pip install mysqlclient
which gives this error:
Collecting mysqlclient
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/r9/n0ld0jk57x590rzq5kv8x4wc0000gn/T/pip-build-ZZb7dn/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 54, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "setup_posix.py", line 12, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r9/n0ld0jk57x590rzq5kv8x4wc0000gn/T/pip-build-ZZb7dn/mysqlclient/
Also tried it pip install MySQL-python
, but it also gives the same error message.
Am I doing something wrong here? Please point me in the right direction, I recently switched from linux to mac os and I'm a little confused as to how things work here.
Note. I am trying to do this in virtual environment
.
source to share
For python3 + django11.1 + mysql on mac. This worked for me:
-
brew install mysql-connector-c
- change mysql_config (found him
which mysql_config
)
Change the following in mysql_config:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
To:
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
-
brew info openssl
-
and finally
pip3 install mysqlclient
source to share