Я пытался понять это пару дней.Я пытаюсь создать проект django в виртуальной среде и установить на него mysqlclient.Процесс пошел так: В моем проекте путь:
virtualenv pyvenv1
Затем я активировал его:
source /pyvenv1/bin/activate
Затем я установил django:
pip install django
Затем я сделалновый проект:
django-admin startproject djangop1
Затем внутри этого проекта я пытаюсь установить mysqlclient
pip install mysqlclient
Я получаю следующее:
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /Users/daniel/Documents/Python/DjangoP1/py1/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-install-xgahev5_/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-wheel-4_cp0769 --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
copying _mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.9-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.7/_mysql.o
_mysql.c:257:6: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
s = PyUnicode_AsUTF8(item);
^ ~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:287:6: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
s = PyUnicode_AsUTF8(item);
^ ~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:564:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(ca, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:565:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(capath, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:566:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(cert, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:567:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(key, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:568:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(cipher, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:2530:8: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
cname = PyUnicode_AsUTF8(name);
^ ~~~~~~~~~~~~~~~~~~~~~~
8 warnings generated.
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /Users/daniel/Documents/Python/DjangoP1/py1/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-install-xgahev5_/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-record-fnk1xc7q/install-record.txt --single-version-externally-managed --compile --install-headers /Users/daniel/Documents/Python/DjangoP1/py1/bin/../include/site/python3.7/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
copying _mysql_exceptions.py -> build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.9-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c _mysql.c -o build/temp.macosx-10.9-x86_64-3.7/_mysql.o
_mysql.c:257:6: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
s = PyUnicode_AsUTF8(item);
^ ~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:287:6: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
s = PyUnicode_AsUTF8(item);
^ ~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:564:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(ca, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:565:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(capath, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:566:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(cert, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:567:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(key, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:568:3: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
_stringsuck(cipher, value, ssl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:553:16: note: expanded from macro '_stringsuck'
if(t){d=PyUnicode_AsUTF8(t);ssl_keepref[n_ssl_keepref++]=t;}\
^~~~~~~~~~~~~~~~~~~~
_mysql.c:2530:8: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
cname = PyUnicode_AsUTF8(name);
^ ~~~~~~~~~~~~~~~~~~~~~~
8 warnings generated.
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/Users/daniel/Documents/Python/DjangoP1/py1/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-install-xgahev5_/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-record-fnk1xc7q/install-record.txt --single-version-externally-managed --compile --install-headers /Users/daniel/Documents/Python/DjangoP1/py1/bin/../include/site/python3.7/mysqlclient" failed with error code 1 in /private/var/folders/1h/dg482p2x2bz7n46_px8nphf40000gn/T/pip-install-xgahev5_/mysqlclient/
В документах mysqlclient,он сказал, что мне сначала нужно сделать:
brew install mysql-connector-c
Затем отредактировать mysql_config
Я сделал оба.
Мой $ PATH:
/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Я также установил gcc, используя brew, та же ошибка.
Я довольно растерян, любая помощь будет оценена.
Спасибо!