After `conda install tensorflow-gpu`, it happens `no module named conda`

Problem [2019-07-05]

Firstly, I install miniconda, and it shows

zty@206:~$ conda --version
conda 4.5.4
zty@206:~$ python --version
Python 3.6.5 :: Anaconda, Inc.

However, after I run conda install tensorflow-gpu, and test its usability by

import tensorflow as tf
tf.__version__
c = tf.constant(3.0)
sess = tf.Session()
sess.run(c)

Then, when I typed in conda ***, it happens

zty@206:~$ conda list | grep tensor
Traceback (most recent call last):
  File "/new_disk_1/zty/miniconda3/bin/conda", line 7, in <module>
    from conda.cli import main
ModuleNotFoundError: No module named 'conda'

Reason

I removed the corrupted miniconda and re-installed it several times. Finally, I found that, Install Tensorflow makes the python version update from 3.6.5 to 3.7.3, and you can find that during the installation procedure: python-3.7.3 | 36.7 MB |. The reason is that the newly installed python 3.7.3 doesn’t have the conda package. So when from conda.cli import main, it cannot find conda package from ~/miniconda3/lib/python3.6/site-packages/.

Solution

Finally, I solved it by conda create -n tf first, then source activate tf, and install tensorflow-gpu inside the virtual environment.

conda create -n tf
source activate tf
conda install tensorflow-gpu
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值