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
from conda.cli import main
ModuleNotFoundError: No module named 'conda'
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/
.
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