出现报错:
解决方法:
一、在command页面直接安装第三方库
pip install xxxxxx
二、在pycharm 左下角选择Interpreter Setting,再点击加号,输入第三方库名称,然后点击左下角Install Pakage,安装即可。
三、2.x版本的tensorflow不支持很多第三方库,我试了很多种办法,还是觉得直接安装1.x版本的最直接有效(简单粗暴)。对应的,可能需要将
numpy降版本
,
因为安装的tensorflow版本和numpy版本不匹配。
先卸载tensorflow:
pip uninstall tensorflow
再安装新版本:
pip install tensorflow1.xx
查看pycharm适应版本,再安装:
pip install tensorflow==1.14 -i https://pypi.douban.com/simple
当运行代码后,报错提示numpy版本不匹配时:
比如,我出现了一下报错: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’. _np_qint32 = np.dtype([(“qint32”, np.int32, 1)])
建议安装:或其他版本
pip install numpy==1.16.0
后,正常运行。