Установите mysqlclient через ошибки сброса pipenv

Я использую джанго и mysql.

Для связи django с mysql необходимо установить mysqlclient.

Также версия Python 3.7.2

pipenv install mysqlclient

выдает ошибки.

Installing mysqlclient...
✔ Installation Succeeded 
Pipfile.lock (c98c3a) out of date, updating to (a65489)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success! 
Updated Pipfile.lock (c98c3a)!
Installing dependencies from Pipfile.lock (c98c3a)...
An error occurred while installing mysqlclient==1.4.2.post1 --hash=sha256:425e733b05e359a714d6007c0fc44582be66b63e5a3df0a50949274ae16f4bc6 --hash=sha256:62e4770b6a797b9416bcf70488365b7d6b9c9066878108499c559293bb464380 --hash=sha256:f257d250f2675d0ef99bd318906f3cfc05cef4a2f385ea695ff32a3f04b9f9a7! Will try again.
  ????   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:02
Installing initially failed dependencies...
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]:       skip_lock=skip_lock,
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python2.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting mysqlclient==1.4.2.post1 (from -r /var/folders/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pipenv-bV3RGM-requirements/pipenv-bOkuhH-requirement.txt (line 1))', '  Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz', 'Building wheels for collected packages: mysqlclient', '  Building wheel for mysqlclient (setup.py): started', "  Building wheel for mysqlclient (setup.py): finished with status 'error'", '  Running setup.py clean for mysqlclient', 'Failed to build mysqlclient', 'Installing collected packages: mysqlclient', '  Running setup.py install for mysqlclient: started', "    Running setup.py install for mysqlclient: finished with status 'error'"]
[pipenv.exceptions.InstallError]: ['ERROR: Complete output from command /Users/hide/.local/share/virtualenvs/horang-mnXaGoVY/bin/python3.7 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-install-83zphs9u/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/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-wheel-jhcy1h95 --python-tag cp37:', '  ERROR: running bdist_wheel', '  running build', '  running build_py', '  creating build', '  creating build/lib.macosx-10.14-x86_64-3.7', '  creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '  creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '  warning: build_py: byte-compiling is disabled, skipping.', '  ', '  running build_ext', "  building 'MySQLdb._mysql' extension", '  creating build/temp.macosx-10.14-x86_64-3.7', '  creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb', "  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/local/opt/[email protected]/include/mysql -I/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o", '  clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/opt/[email protected]/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_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 'clang' failed with exit status 1", '  ----------------------------------------', '  ERROR: Failed building wheel for mysqlclient', '    ERROR: Complete output from command /Users/hide/.local/share/virtualenvs/horang-mnXaGoVY/bin/python3.7 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-install-83zphs9u/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/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-record-t6u87iq3/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hide/.local/share/virtualenvs/horang-mnXaGoVY/bin/../include/site/python3.7/mysqlclient:', '    ERROR: running install', '    running build', '    running build_py', '    creating build', '    creating build/lib.macosx-10.14-x86_64-3.7', '    creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/compat.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/connections.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/converters.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/cursors.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/release.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    copying MySQLdb/times.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb', '    creating build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-x86_64-3.7/MySQLdb/constants', '    warning: build_py: byte-compiling is disabled, skipping.', '    ', '    running build_ext', "    building 'MySQLdb._mysql' extension", '    creating build/temp.macosx-10.14-x86_64-3.7', '    creating build/temp.macosx-10.14-x86_64-3.7/MySQLdb', "    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/local/opt/[email protected]/include/mysql -I/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o", '    clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk build/temp.macosx-10.14-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/opt/[email protected]/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/MySQLdb/_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 'clang' failed with exit status 1", '    ----------------------------------------', 'ERROR: Command "/Users/hide/.local/share/virtualenvs/horang-mnXaGoVY/bin/python3.7 -u -c \'import setuptools, tokenize;__file__=\'"\'"\'/private/var/folders/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-install-83zphs9u/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/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-record-t6u87iq3/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hide/.local/share/virtualenvs/horang-mnXaGoVY/bin/../include/site/python3.7/mysqlclient" failed with error code 1 in /private/var/folders/ll/4ql5wb555rqb9xcsdzr624b80000gn/T/pip-install-83zphs9u/mysqlclient/']
ERROR: ERROR: Package installation failed...

Пробовал pipenv install mysqlclient==1.13.13, тоже не работает.

Есть ли здесь решение?

Спасибо.


person Hide    schedule 14.05.2019    source источник
comment
Вы установили клиентскую библиотеку? sudo apt установить libmysqlclient-dev. После того, как это установлено, попробуйте, может быть?   -  person smitty_werbenjagermanjensen    schedule 14.05.2019
comment
@JoeA Я использую OSX, и это виртуальная среда.   -  person Hide    schedule 14.05.2019
comment
Хмммммм, я собираюсь дать вам две ссылки, которые могут помочь, потому что я не на 100% уверен в Mac OSX medium.com/@shandou/ stackoverflow.com/questions/43612243/   -  person smitty_werbenjagermanjensen    schedule 14.05.2019
comment
Вы нашли ответ? Я сталкиваюсь с этой же проблемой.   -  person Kristen    schedule 03.07.2019
comment
@ Кристен, я добавил ответ. Пожалуйста, проверь это.   -  person Hide    schedule 03.07.2019
comment
Есть предложения для пользователей Windows?   -  person mjwrazor    schedule 28.09.2020


Ответы (4)


РЕШЕНО

brew install openssl
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient

Я использую OSX Mojave, и я думаю, что это вызвано версией OSX.

person Hide    schedule 03.07.2019

Сначала мне пришлось установить эти 3 пакета, чтобы заставить его работать на меня:

  • python3-dev
  • libmysqlclient-dev
  • libssl-dev
person run_the_race    schedule 01.07.2019
comment
Особенно верно, если вы находитесь на облачном сервере, где они немного урезают ОС. - person run_the_race; 29.04.2021

Установите следующие пакеты:

sudo apt-get install python3.7-dev libmysqlclient-dev

Обратите внимание, что вам нужно python3.7-dev, а не python3-dev.

Затем запустите:

pipenv install
person Derek C    schedule 02.07.2019

для тех, кто приходит сюда, используя Ubuntu 19.10 быстро:

sudo apt-get install libmysqlclient-dev

с последующим

pipenv install mysql-client

решил это для меня.

person Maik Ro    schedule 27.02.2020