为什么 'tensorflow' 模块导入在 Spyder 中失败而不是在 Jupyter Notebook 中而不是在 Python 提示符中?
Why does the 'tensorflow' module import fail in Spyder and not in Jupyter Notebook and not in Python prompt?
我已经有十多年没有使用 Linux/Unix 了。为什么 'tensorflow' 模块导入在 Spyder 中失败而不是在 Jupyter Notebook 中而不是在 Python 提示符中?
情景:
- [终端] spyder
- [spyder][IPython console] 在 IPython console
中输入 'import tensorflow as tf'
当前结果:
- [spyder][IPython console] 消息错误:'ImportError: No module named 'tensorflow''
附加信息:
- OS: Ubuntu 14.04 (VMWare)
- Python:Python 3.5.2 :: Anaconda 自定义(64 位)
- 安装 TensorFlow:
- [终端] sudo -s
- [终端] conda create --name=IntroToTensorFlow python=3 anaconda
- [终端]源码激活IntroToTensorFlow
- [终端] conda install -c conda-forge tensorflow
- 路径 = $路径:/home/mo/anaconda3/envs/IntroToTensorFlow/bin
评论:
- 当我重放以下场景时,它工作正常:
- [终端] sudo -s
- [终端]源码激活IntroToTensorFlow
- [终端机]python
- [python] 将 tensorflow 导入为 tf
- 当我在 Jupyter Notebook 中重放 tensorflow 导入时,它也工作正常
到目前为止我做了什么:
- 我谷歌了一下,但没有找到合适的答案
- 我在 Stack Overflow 问题中进行了搜索
这可能是环境变量的问题。试试答案 here and :
LD_LIBRARY_PATH=/usr/local/cuda/lib64
CUDA_PATH=/usr/local/cuda
(代表OP发表).
已解决:我重新安装了spyder,现在可以正常使用了。谢谢。
我已经有十多年没有使用 Linux/Unix 了。为什么 'tensorflow' 模块导入在 Spyder 中失败而不是在 Jupyter Notebook 中而不是在 Python 提示符中?
情景:
- [终端] spyder
- [spyder][IPython console] 在 IPython console 中输入 'import tensorflow as tf'
当前结果:
- [spyder][IPython console] 消息错误:'ImportError: No module named 'tensorflow''
附加信息:
- OS: Ubuntu 14.04 (VMWare)
- Python:Python 3.5.2 :: Anaconda 自定义(64 位)
- 安装 TensorFlow:
- [终端] sudo -s
- [终端] conda create --name=IntroToTensorFlow python=3 anaconda
- [终端]源码激活IntroToTensorFlow
- [终端] conda install -c conda-forge tensorflow
- 路径 = $路径:/home/mo/anaconda3/envs/IntroToTensorFlow/bin
评论:
- 当我重放以下场景时,它工作正常:
- [终端] sudo -s
- [终端]源码激活IntroToTensorFlow
- [终端机]python
- [python] 将 tensorflow 导入为 tf
- 当我在 Jupyter Notebook 中重放 tensorflow 导入时,它也工作正常
到目前为止我做了什么:
- 我谷歌了一下,但没有找到合适的答案
- 我在 Stack Overflow 问题中进行了搜索
这可能是环境变量的问题。试试答案 here and
LD_LIBRARY_PATH=/usr/local/cuda/lib64 CUDA_PATH=/usr/local/cuda
(代表OP发表).
已解决:我重新安装了spyder,现在可以正常使用了。谢谢。