【问题标题】:Can't import tensorflow in Python 3.6.6无法在 Python 3.6.6 中导入 tensorflow
【发布时间】:2018-10-02 14:41:36
【问题描述】:

我用pip3 install tensorflow 安装了tensorflow,然后我打开了输入pythonimport tensorflow 的终端。

但是当我点击 Enter 时,它给了我一个错误:

Invalid machine command (memory dump written)

我已经多次重新安装了 tensorflow,但它不起作用。有人可以帮我吗?

【问题讨论】:

  • 尝试用'python3'启动python
  • 要安装哪个版本的 tensorflow? (应该在 pip3 安装的日志中)。还可以考虑使用 anaconda 创建一个虚拟环境。以我的经验,这种方式更容易让 tensorflow 运行
  • 这是 tensorflow v.1.11.0
  • 我尝试在 tensorflow 中安装 tensorflow,但它也无法正常工作

标签: python python-3.x tensorflow pip


【解决方案1】:

不确定究竟是什么导致了您的问题,但如果您在线搜索相同的问题和可能的解决方案,您可以访问此处:https://github.com/tensorflow/tensorflow/issues/17411

基本上一个解决方案是安装较早的 tensorflow 版本。

试试:

pip uninstall tensorflow
pip install tensorflow==1.5

【讨论】:

    【解决方案2】:
    1. 安装 anaconda 或 miniconda
    2. conda create -n tensorflow python=3.6创建一个virtualenv
      2.5 使用source activate tensorflow激活环境
    3. 在 virtualenv (tensorflow)name@name$ 中输入 conda install tensorflow
    4. 安装类型后(总是在 virtualenv 中)python3 然后import tensorflow
    5. 始终在 virtualenv 中启动 tensorflow。停用 virtualenv 类型exit 重新激活它输入source activate tensorflow

    【讨论】:

      猜你喜欢
      • 2019-03-18
      • 2021-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      • 1970-01-01
      • 2018-06-12
      • 1970-01-01
      相关资源
      最近更新 更多