今天繼續學習flask。之前都是在Jupyter notebook上搞,可是好像只能編輯原始代碼,不能進一步開發。要麼就是在ubuntu上面直接拷貝粘貼,可是好像仍是不是很專業。因此但願用一下pycharm進行開發。python
遇到下面的問題:mysql
pip install flask-mysqldbsql
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/flask
網上解決方案以下:
安裝flaskmysqldb報錯.代表缺乏相關輪子ubuntu
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
解決辦法:學習
1 下載相關wheel網站
網站:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-pythonui
下載軟件:mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl (由於個人是64位系統,因此安裝64位)this
安裝這個whl:將其放在你的python環境裏面.spa
pip install D:\ProgramDefineApp\Anaconda3\envs\flask_venv\mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl
2 就能夠安裝flask-mysqldb
pip install flask-mysqldb
本人操做以下:
在Anaconda環境
(base) E:\zcm下載>python --version
Python 3.7.4
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
下載合適的版本mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl
(base) E:\download>pip install mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl
Processing e:\download\mysqlclient-1.4.6-cp37-cp37m-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6
但實際上開發用的是pycharm環境,還須要從新下載
下載mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
pycharm下面
(venv) C:\Users\Administrator\PycharmProjects>pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
首先肯定python的具體版本
(venv) C:\Users\Administrator\PycharmProjects>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp38', 'cp38m', 'win_amd64'), ('cp38', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp38', 'none', 'any'), ('cp3', 'none', 'any'), ('py38', 'none', 'any'), ('py3', 'none', 'any'
), ('py37', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'n
one', 'any')]
修改文件名
mysqlclient-1.4.6-cp38-cp38m-win_amd64.whl
從新安裝
(venv) C:\Users\Administrator\PycharmProjects>pip install mysqlclient-1.4.6-cp38-cp38m-win_amd64.whl
Processing c:\users\administrator\pycharmprojects\mysqlclient-1.4.6-cp38-cp38m-win_amd64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6
完美解決mysqlclient安裝pip install flask-mysqldb隨之安裝成功