Python笔记——tensorflow错误笔记:PyCharm下各种模块导入问题和AttributeError:

之前在windows下装了TensorFlow和Anaconda,运行环境是Pycharm.

开始直接在cmd下试的没问题,运行命令:pytho fileneme.py,感觉用着不方便,还是学着用PyCharm吧。不过二者遇到的问题都是一致的,可用同样方法解决

错误1:模块导入问题

正常情况下,导入各种模块、包时,在 File->Settiings->Project:project_name->Project Interpreter 中,点右上角‘+’,直接搜索安装即可。不过总是有很多问题出现,比如开始的找不到tsfresh,安装时出现错误:error:Microsoft Visual C++ 14.0 is required.其他一些模块也有这个问题。

Python笔记——tensorflow错误笔记:PyCharm下各种模块导入问题和AttributeError:

解决办法:

法1:pycharm终端输入pip install xxx,直接安装。不行转2.

法2:网上直接下载对应的whl文件,再终端pip安装pip install xxx.whl。

 一般直接搜即可,这里给出一个地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

 tsfresh地址:https://pypi.python.org/pypi/tsfresh

法3:将对应的包直接放在工程目录下。如:tsfresh问题,干脆把Anaconda3\Lib\site-packages下的整个tsfresh文件夹放到了工程目录下,错误消失。


错误2:AttributeError: module 'pandas.core.computation' has no attribute 'express

前面还有一堆文件文件代码定位,没截图。最后一句是AttributeError: module 'pandas.core.computation' has no attribute 'express。

解决办法:

升级dask即可,直接cmd下,pip install --upgrade dask,(Pycharm则直接在终端输入),完成后提示Successfully installed.

Python笔记——tensorflow错误笔记:PyCharm下各种模块导入问题和AttributeError:

再运行,成功!Python笔记——tensorflow错误笔记:PyCharm下各种模块导入问题和AttributeError:

ps: 程序文件和数据文件最好都放在工程根目录下。