Tensorflow install fails with “compiletime version 3.5 of module does not match runtime version 3.6”

后端 未结 8 2007
北海茫月
北海茫月 2021-02-04 01:51

I tried installing from pip:

pip3 install --user --no-cache https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl
         


        
8条回答
  •  春和景丽
    2021-02-04 02:44

    I encountered the same problem and I fixed it by:

    pip install --ignore-installed tensorflow
    

    The problem occurred because I complied a local version of tensorflow (to enable some CPU features) with python 3.5 earlier. I installed python 3.6 recently and the new tensorlfow already supported those CPU features, so I just installed the official version.

    Update:

    After some update of tensorflow the approach above doesn't work any more.

    Another workaround is using virtual environment such as anaconda to create a python3.5 environment:

    conda create -n py35 python=3.5
    source activate py35
    pip install tensorflow
    

    To work with ipython or jupyter notebook, be sure to install ipykernel inside the virtual environment:

    pip install ipykernel
    

提交回复
热议问题