原文地址:https://blog.csdn.net/weixin_41611013/article/details/80508397
Python2.7 Windows系统,在虚拟环境中安装了MySQL-Python包,在Python命令行中import MySQLdb没有提示错误,但在pycharm中运行manage.py Task 时却提示未安装MySQL-Python,解决办法:
1.将下载好的MySQL-Python文件复制到Djangoproject(项目目录)>venv>Scripts下面,附位下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
2.通过cmd命令行进入Djangoproject>venv>Scripts 执行命令pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl(这个.whl文件的地址:https://github.com/ANGELHACK-JARVIS/safe-locality/blob/master/MySQL_python-1.2.5-cp27-none-win_amd64.whl)
回到pycharm重新运行manage.py Task ,没有错误提示,表示pycharm已经导入MySQLdb模块