【问题标题】:cannot import tensorflow (installed with anaconda) in Visual Studio IDE无法在 Visual Studio IDE 中导入 tensorflow(随 anaconda 一起安装)
【发布时间】:2017-02-26 11:49:13
【问题描述】:

关注these steps,我在win10笔记本上成功安装了Tensorflow 1.0.0 GPU版本,使用anaconda虚拟环境(我对此知之甚少,请按提示操作)

我以这样的交互模式运行 HelloWorld 代码:

activate tensorflow
python
import tensorflow as tf
# ...

但是,当我在 anaconda 的编辑器或 Visual Studio 2015(社区版)中编写时,我无法运行它。它说

没有名为 tensorflow 的模块

我在 VS 中的配置是: pic

那么,任何人都可以提供一些关于如何在 VS 中愉快地编写 tensorflow 程序的提示吗?谢谢!

【问题讨论】:

  • Visual Studio IDE 的 python 路径上有 conda 包安装目录吗?
  • @scai 你是说我图片中的最后一个配置项吗?也许是这个原因,所以你能更具体地给我解释一下吗?这里的“PYTHON_PATH”是否等于我的系统环境变量?

标签: visual-studio tensorflow anaconda


【解决方案1】:

您必须使用以下命令在 Anaconda 中创建一个环境。

conda create -n tf tensorflow

导航到 Anaconda -> 环境 -> 您将看到 tf 环境。选择它,然后启动 VS 代码。

如果您需要将其他软件包安装到同一环境中,您可以使用以下命令。 (例如:安装 pytest)

conda install -n tf pytest

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-02
    • 2019-06-11
    • 1970-01-01
    • 2018-03-17
    • 2016-02-22
    • 2016-01-30
    • 1970-01-01
    相关资源
    最近更新 更多