TensorFlow部分导入
当我运行脚本并从CMD或Visual Studio代码导入TensorFlow时,它会给我带来错误
but when I run it from Anaconda prompt or Spyder it works well. 为什么会发生???我必须添加任何路径吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是由于
python
和TensorFlow
仅安装在Anaconda环境中。TensorFlow
从命令提示符而不是anaconda提示
,您需要按照以下步骤操作:open
命令提示
当管理员(通过右键单击并选择运行为管理员)TensorFlow
,您需要安装 python扩展名 vs code post在系统中安装VS代码。成功安装扩展程序后,您可以单击“创建新的Jupyter笔记本”,然后选择适当的Python解释器,如Anaconda中。现在,VS代码可以运行
TensorFlow
代码。请检查 this 供您参考的链接。
This is due to
Python
andTensorFlow
being installed only in your anaconda environment.TensorFlow
from command prompt rather thananaconda prompt
, you need to follow the steps below:Open
command prompt
as administrator (by right click and selecting run as administrator)TensorFlow
through VS code, you need to install python extension for VS code post installing VS code in your system. After successful installation of extension, you can click on "Create new Jupyter notebook" and select the appropriate Python interpreter as in Anaconda.Now the VS code is ready to run
TensorFlow
code.Please check this link for your reference.