如何在 PyCharm 中安装 MySQLdb,Windows,python2.7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35930924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Install MySQLdb in PyCharm, Windows,python2.7
提问by tanxin
I am new to Python(I am using Python2.7) and Pycharm, but I need to use MySQLdb module to complete my task. I spent time to search for some guides or tips and finally I go to here but does not found MySQLdb to install. MySQL-python
我是 Python(我使用的是 Python2.7)和 Pycharm 的新手,但我需要使用 MySQLdb 模块来完成我的任务。我花了一些时间搜索一些指南或提示,最后我去了这里但没有找到要安装的 MySQLdb。 MySQL-python
But there is error: Error
但是出现错误: 错误
回答by Karl Doenitz
I have a suggestion,if you have install MySQL database,you follow this,open pycharm and click File->Settings->Project->Project Interpreter,then select your Python interpreter and click install button (the little green plus sign),input "MySQL-Python" and click the button "install package",you will install MySQL-Python successfully.If you have not install MySQL database,you need install MySQL database first.
我有一个建议,如果你已经安装了 MySQL 数据库,你按照这个,打开 pycharm 并点击 File->Settings->Project->Project Interpreter,然后选择你的 Python 解释器并点击安装按钮(小绿色加号),输入“MySQL-Python”,点击“安装包”按钮,即可成功安装MySQL-Python。如果您还没有安装MySQL数据库,则需要先安装MySQL数据库。
回答by Niti Gupta
If you are unable to install MySQL CLient in Pycharm, try opening the Terminal (Alt+F12) and write the command
如果无法在 Pycharm 中安装 MySQL CLient,请尝试打开终端(Alt+F12)并编写命令
pip install --only-binary :all: mysqlclient
This might help!
这可能会有所帮助!
回答by ode2k
From Windows Command Prompt / Linux Shell
从 Windows 命令提示符/Linux Shell
install using wheel
使用轮子安装
pip install wheel
Download 32 or 64 Bit version from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
从http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python下载 32 或 64 位版本
64-Bit
64 位
pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl
32-Bit
32位
pip install MySQL_python-1.2.5-cp27-none-win32.whl
Using Anaconda2:
使用 Anaconda2:
Open a Command Prompt
打开命令提示符
$ conda install mysql-python
Press y to proceed with installation
按y继续安装