#python #mysql #pip #mysql-python
#python #mysql #pip #mysql-python
Вопрос:
Я пытаюсь установить mysqlclient
для приложения Django, но при запуске получаю следующую ошибку sudo pip install mysqlclient
Command "/Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-6mmeJ5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-wmyB7z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/include/site/python2.7/mysqlclient" failed with error code 1 in /private/tmp/pip-install-6mmeJ5/mysqlclient/
Полный вывод терминала:
Collecting mysqlclient
Downloading https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
100% |████████████████████████████████| 92kB 987kB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-6mmeJ5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-wmyB7z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/include/site/python2.7/mysqlclient:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-intel-2.7
creating build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb
creating build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-intel-2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-intel-2.7
creating build/temp.macosx-10.14-intel-2.7/MySQLdb
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/local/Cellar/mysql-connector-c/6.1.11/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-intel-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c:1126:33: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/intobject.h:34:46: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^
1 warning generated.
MySQLdb/_mysql.c:304:23: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
int j, n2=PySequence_Size(fun);
~~ ^~~~~~~~~~~~~~~~~~~~
MySQLdb/_mysql.c:892:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_real_escape_string_quote(amp;(self->connection), out, in, size, ''');
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MySQLdb/_mysql.c:897:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_escape_string(out, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MySQLdb/_mysql.c:1126:33: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/intobject.h:34:46: note: passing argument to parameter here
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^
MySQLdb/_mysql.c:1215:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
MySQLdb/_mysql.c:1217:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
MySQLdb/_mysql.c:1253:23: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
MySQLdb/_mysql.c:1255:23: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
8 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/MySQLdb/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-6mmeJ5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-wmyB7z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jimmymona/Development/onBeat/TFS/USDSA/udsa_content_repository/venv/include/site/python2.7/mysqlclient" failed with error code 1 in /private/tmp/pip-install-6mmeJ5/mysqlclient/
Я также пытался использовать MySQL-python
, но это дало ту же ошибку.
Кто-нибудь знает, в чем может быть проблема?
Комментарии:
1.
ld: library not found for -lssl
2. Вы знаете, как я могу это исправить?
3. Поскольку я нашел это для macOS,
brew install openssl
4. Я получаю
Warning: openssl 1.0.2r is already installed and up-to-date
5. Смотрите здесь: superuser.com/questions/1089390 /…