使用Pycharm,tensorflow1.13.1中的keras等库出现cannot find declaration to go to的问题
2020-02-05 17:25
633 查看
使用Pycharm,tensorflow1.13.1中的keras等库出现cannot find declaration to go to的问题
使用Pycharm编写python程序,import numpy、os,使用ctrl+鼠标左键都能够直接转到方法定义处,但是,import tensorflow.keras中,tensorflow可以转到方法定义处,keras则会出现cannot find declaration to go to的问题,相关的代码无法自动补全,。
估计是tensorflow版本的问题:
(1)查看Project Interpreter,Package列表中有tensorflow,版本是1.13.1。同学的Package列表里面却没有tensorflow。
(2)尝试Invalidate Caches之后,无果。
(3)尝试将同学电脑的tensorflow文件夹下的__init__.py(28K)文件替换我的这个__init__.py(32K)文件,原来可以正常run的,不能正常run了,显示:
File “D:\ProgramData\Anaconda3\lib\site-packages\tensorflow_init_.py”, line 39, in
from tensorflow import app
ImportError: cannot import name ‘app’
最终解决:
在import tensorflow之后,要加.python,例如,原来是from tensorflow.keras…import…现在要写成from tensorflow.python.keras…
完事儿~
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- pycharm跳转到定义和声明,出现的问题:Cannot find declaration to go to
- Android Studio 出现 idea Cannot find declaration to go to
- [pycharm] cannot find declaration to go to
- pycharm Cannot find declaration to go to
- pycharm Cannot find declaration to goto----解决方案
- idea Cannot find declaration to go to问题的解决
- [pycharm] cannot find declaration to go to
- Intellij IDEA ,按Ctrl+左键,不能进入类或方法的【解决办法】,提示Cannot find declaration to go to
- 新打开的项目,一片红,按住Ctrl点减去报:Cannot find declaration to go to
- 解决使用Genymotion出现Unable to start the virtual device.VirtualBox cannot start the virtual device.问题
- Android studio import module Cannot find declaration to go to
- Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
- 解决使用python3.5来获取PCL库出现 unable to find vcvarsall.bat的问题
- 使用webservlert注解时出现WebServlet cannot be resolved to a type的问题
- IntelliJ IDEA Cannot find declaration to go to
- 解决使用Struts2的s:textfield标签出现Unable to find setter method for attribute: style的问题
- “Cannot find declaration to go to”“cannot find settings.jar”“gradle:download https://….. ”
- linux使用velocity出现的一个奇葩问题-Unable to find resource
- 虚拟机中出现 Cannot find a valid peer process to connect to 问题的解决办法
- 问题解决:打开word2010时出现“Cannot find the Word template:WordToRqm.dot”