python - pip install myclient 错误 - 在 Windows 7 上使用 Python 3.7.0

标签 python mysql django pip

我目前正在学习 Django 教程,在尝试安装 mysqlclient 后,我​​的 CMD 上出现以下错误消息。

提前非常感谢

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 c:\users\o\envs\py1\scripts\python.exe -u
-c "import setuptools, 
 tokenize;__file__='C:\\Users\\O\\AppData\\Local\\T
 emp\\pip-install-kej8gk5_\\mysqlclient\\setup.py';f=getattr(tokenize, 
'open', op
 en)(__file__);code=f.read().replace('\r\n', 
  '\n');f.close();exec(compile(code, _
   _file__, 'exec'))" install --record 
  C:\Users\O\AppData\Local\Temp\pip-reco
  rd-_27hw8hl\install-record.txt --single-version-externally-managed -- 
 compile --install-headers 
  c:\users\o\envs\py1\include\site\python3.7\mysqlclient:
running install

running build

running build_py

creating build

creating build\lib.win32-3.7

copying _mysql_exceptions.py -> build\lib.win32-3.7

creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32- 
 3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32- 
 3.7\MySQLdb\constants

copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32- 
 3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32 3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

最佳答案

我建议使用 python 64 位。

当mysql是64位而python是32位时,当我们通过这个网站强制安装mysqlclient Python Extension Package时,就会出现这个问题。 或者您可以同时安装 32 位 pip 安装 mysqlclient 或者使用这个:pip install --only-binary :all: mysqlclient 使用64位python您可以轻松安装它。

关于python - pip install myclient 错误 - 在 Windows 7 上使用 Python 3.7.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51840644/

相关文章:

python - 我的 A Star 实现不会返回到达目的地的步骤列表

mysql - 如何预处理使用 sqlx 获取的行?

php - 我如何使用 php 检索段落的匹配字符串

python - Django 模板加载器行为? (得到 Django TemplateDoesNotExist 异常)

python - 当一行中有 ddd 时,正则表达式模式仅获取 3 位数值

python - 日期时间字段的格式

python - 使用 postgres 在 django 范围字段中将 Infinity 设置为默认值

php - 下拉框显示用户名,选择后获取用户号码

Django 在测试中加载固定装置(不是来自已安装的应用程序)

python - Django url 模板标签添加绝对文件路径