首页 > 解决方案 > pip安装mysqlclient错误django

问题描述

我目前正在使用 MySQL 8.0 作为我的 Django 项目的数据库。我正在使用 Python 3.6 版本并已安装pip以从 Internet 加载 python 模块。使用 pip 加载 mysqlclient 以外的包时,我没有遇到问题。

我发出了命令pip install mysqlclient,最后得到以下消息,安装被中止:

"c:\users\anirudh\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Anirudh\\AppData\\Local\\Temp\\pip-install-xer9o7aw\\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 C:\Users\Anirudh\AppData\Local\Temp\pip-record-t3br6ckm\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Anirudh\AppData\Local\Temp\pip-install-xer9o7aw\mysqlclient\

我正在使用 Visual Studio 2017,并按照下面的链接解决了这个问题,但没有运气。

https://dimitri.janczak.net/2017/05/20/python-3-6-visual-studio-2017/

标签: djangopython-3.xpipwindows-10mysql-connector-python

解决方案


我尝试mysqlclient使用 pip 安装。但我没有成功。我能够使用以下方法安装它:

conda install mysqlclient

它对我来说很好。


推荐阅读