首页 > 解决方案 > 在 PyCharm 社区版中安装 mysql

问题描述

我之前找不到这个问题,这让我发疯。如果这个问题是重复的,如果有人能指出我的答案,我将不胜感激。

我尝试pip install mysql使用 Python 3.6 在 PyCharm 终端中安装 mysql(使用)。这是我得到的错误。我已经将 pip 更新到了最新版本。

命令“C:\Users\David\PycharmProjects\cryptocurrency2\cryptocurrencytrading\Scripts\python.exe -u -c”导入设置工具,标记化;file ='C:\Users\David\AppData\Local\Temp\pip-install-alqyprfu\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\David\AppData\Local\Temp\pip-record-gcaxj074\install-record.txt --single-version-externally-managed --compile --install -headers C:\Users\David\PycharmProjects\cryptocurrency2\cryptocurrencytrading\include\site\python3.6\mysqlclient" 在 C:\Users\David\AppData\Local\Temp\pip-install-alqyprfu\ 中出现错误代码 1 失败mysqlclient\ 您使用的是 pip 版本 10.0.1,但版本 18.1 可用。您应该考虑通过“python -m pip install --upgrade pip”命令进行升级。

标签: pythonpippycharmmysql-python

解决方案


您可以使用 PyCharm 的包管理器在没有 pip 的情况下安装 python 包。请参考他们的官方文档关于安装包here

或者您也可以始终使用您的操作系统 cmd 显式安装软件包。

我建议您应该通过以下方式更新您的 pip 版本:

python -m pip install --upgrade pip

希望这可以帮助!


推荐阅读