【发布时间】:2018-12-26 13:32:37
【问题描述】:
我是 django 新手,但我知道 MySQL。但是,我想将 django 与 mysql 连接,但此时我必须安装 mysqlclient 但出现错误。我已经安装了mysql服务器,创建了一个virtualenv但仍然无法安装mysqlclient。
这是我得到的错误:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
命令 "/home/devesh/django-apps/myproject/myprojectenv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-vaq3j43s/ 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 /tmp/pip-record-v5qqxse5/install-record.txt -- single-version-externally-managed --compile --install-headers /home/devesh/django-apps/myproject/myprojectenv/include/site/python3.5/mysqlclient" 失败,错误代码 1 在 /tmp/pip-install -vaq3j43s/mysqlclient/
【问题讨论】:
-
当你安装mysqlclient时,它包含一些需要gcc编译器编译的文件,所以你应该在你的机器上安装适当版本的gcc,并将其路径设置为环境变量