django安装mysqlclient (Windows下正确安装mysqlclient)

django安装mysqlclient (Windows下正确安装mysqlclient)由于本人也是初学 Python 和 django 本人使用的 Python 版本是 3 7 所以连接 MySQL 数据库需要安装数据驱动 对应 Python3 的数据驱动是 mysqlclient 因此本人习惯性的使用命令 pipinstallmy 结果安装失败 venv C Users songlihui PycharmProje autotest gt pipinstallmy

由于本人也是初学Python和django。本人使用的Python版本是3.7所以连接MySQL数据库需要安装数据驱动,对应Python3的数据驱动是mysqlclient。因此本人习惯性的使用命令pip install mysqlclient,结果安装失败

(venv) C:\Users\songlihui\PycharmProjects\autotest>pip install mysqlclient Collecting mysqlclient Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9edbb1988ad/mysqlclient-1.3.13.tar.gz Installing collected packages: mysqlclient Running setup.py install for mysqlclient ... error Complete output from command C:\Users\songlihui\PycharmProjects\autotest\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SONGLI~1\\AppData\\Local\ \Temp\\pip-install-1yliga_x\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" i nstall --record C:\Users\SONGLI~1\AppData\Local\Temp\pip-record-d20e0g2u\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\songlihui\Pycharm Projects\autotest\venv\include\site\python3.7\mysqlclient: C:\Users\songlihui\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) 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 ---------------------------------------- Command "C:\Users\songlihui\PycharmProjects\autotest\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SONGLI~1\\AppData\\Local\\Temp\\pip-install-1ylig a_x\\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 \SONGLI~1\AppData\Local\Temp\pip-record-d20e0g2u\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\songlihui\PycharmProjects\autotest\venv\i nclude\site\python3.7\mysqlclient" failed with error code 1 in C:\Users\SONGLI~1\AppData\Local\Temp\pip-install-1yliga_x\mysqlclient\ You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

然后就从网上寻找各种安装的文章,然后发现一篇文章说

到这个地址下载自己版本对应的资源到本地,然后进行安装 https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient 

django安装mysqlclient (Windows下正确安装mysqlclient)

然后我进入下载的资源所在目录

django安装mysqlclient (Windows下正确安装mysqlclient)

然后使用命令安装,结果仍然失败

django安装mysqlclient (Windows下正确安装mysqlclient)

然后又苦苦的寻找各种解决办法和答案,幸运的是又让我找到一篇文章是这么说的

下载32位的版本安装能成功,因此我有继续下载如下图中的版本

django安装mysqlclient (Windows下正确安装mysqlclient)

然后继续执行安装的命令,出人意料,竟然成了!至于原因,因为我的Python版本是32。因此分享给大家,大家有问题欢迎留言评论~

django安装mysqlclient (Windows下正确安装mysqlclient)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/233359.html原文链接:https://javaforall.net

(0)
上一篇 2025年7月26日 下午5:01
下一篇 2025年7月26日 下午5:22


相关推荐

  • docker 视频网站_springboot前后端分离

    docker 视频网站_springboot前后端分离摘要随着计算机应用技术和网络技术的日新月异,宽带视频点播技术因良好的人机交互性和流媒体传输技术倍受教育、娱乐等行业青睐。这里结合平台开发实例,阐述了基于WEB的在线视频点播网站的软件结构和设计实现。本视频点播系统实现用户信息管理、视频文件的添加、删除、修改及在线播放和搜索功能。由于本系统是一个小型系统,所以我们采用基本的MySQL数据库,易于实现。具体实现中将vue及springboot完美融合,力求界面美观、操作流畅。本文主要论述服务器端视频服务平台的搭建、管理功能的具体实现,以及图形用

    2022年8月21日
    5
  • 使用griddata进行均匀网格和离散点之间的相互插值

    使用griddata进行均匀网格和离散点之间的相互插值文章目录1griddata函数介绍2离散点插值到均匀网格3均匀网格插值到离散点4获取最近邻的Index插值操作非常常见,数学思想也很好理解。常见的一维插值很容易实现,相对来说,要实现较快的二维插值,比较难以实现。这里就建议直接使用scipy的griddata函数。1griddata函数介绍官网介绍2离散点插值到均匀网格definterp2d_station_to_gri…

    2022年5月20日
    36
  • 上海电信光猫SA1456C桥接后4K IPTV继续使用[通俗易懂]

    上海电信光猫SA1456C桥接后4K IPTV继续使用[通俗易懂]上海电信光猫SA1456C路由器TL-R488GPM-AC背景:打电话给上海电信客服被告知,改桥接不能看4KIPTV,电信安装师傅也是同一口径。网上也是很多类似观点,解决方案是用软路由方式去改造。这种方案需要软路由,万一不稳定,会影响家庭安定团结的局面。需求:1、光猫直接接IPTV看,有两条IPTV接路由器即可,不需要更改任何东西。2、光猫桥接路由器,路由器宽带拨号,保证贤妻上网和IPTV的基本需求,再接旁路由满足自己小玩法。当然如有移动或联通送的宽带更好。核心:稳定简单,不折腾。如何光

    2022年10月8日
    5
  • 5分钟教你本地化部署DeepSeek R1+Cherry Studio+MCP,轻松打造智能知识库(保姆级教程)

    5分钟教你本地化部署DeepSeek R1+Cherry Studio+MCP,轻松打造智能知识库(保姆级教程)

    2026年3月16日
    2
  • OpenClaw 超级速查表

    OpenClaw 超级速查表

    2026年3月13日
    2
  • 最长递增子序列的三种算法

    最长递增子序列的三种算法转载自:http://qiemengdao.iteye.com/blog/1660229最长递增子序列 问题给定一个长度为N的数组,找出一个最长的单调自增子序列(不一定连续,但是顺序不能乱)。例如:给定一个长度为6的数组A{5,6,7,1,2,8},则其最长的单调递增子序列为{5,6,7,8},长度为4.解法1:最长公共子序列法这个问题

    2022年4月29日
    56

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号