Python系列 | Python3.5安装MysqlClient教程

Python3.5安装MysqlClient

直接使用命令cmd输入:

pip install mysqlclient

报错如下:

D:\Program Files\PyCharm\project>pip install mysqlclient
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21
.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting mysqlclient
  Downloading mysqlclient-2.1.0.tar.gz (87 kB)
     |████████████████████████████████| 87 kB 122 kB/s
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'd:\program files\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\23587\\AppData\\Local\\Temp\\
pip-install-hhfby_h8\\mysqlclient_9af4676749d042b0bbe34570ebed338e\\setup.py'"'"'; __file__='"'"'C:\\Users\\23587\\AppData\\Local\\Temp\\pip-install-
hhfby_h8\\mysqlclient_9af4676749d042b0bbe34570ebed338e\\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 'C:\Users\23587\AppData\Local\Temp\pip-wheel-3n2oukw
v'
       cwd: C:\Users\23587\AppData\Local\Temp\pip-install-hhfby_h8\mysqlclient_9af4676749d042b0bbe34570ebed338e\
  Complete output (25 lines):
  d:\program files\python\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\_exceptions.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\release.py -> build\lib.win-amd64-3.5\MySQLdb
  copying MySQLdb\times.py -> build\lib.win-amd64-3.5\MySQLdb
  creating build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.5\MySQLdb\constants
  running build_ext
  building 'MySQLdb._mysql' extension
  error: [WinError 2] 系统找不到指定的文件。
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient

原因:
MySQLdb不再支持python3
解决方法:
需要到pythonlibs网站上下载.whl文件进行安装
mysqlclient
需要以自己的系统和python版本对应
以64位 python3.5为例
下载后,CD到对应的文件目录执行

pip install mysqlclient-1.4.6-cp35-cp35m-win_amd64.whl

打开pycharm -> setting查看

安装成功
安装成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值