tensorflow、keras安装过程记录

  1. 使用 pip 下载,速度较快:
    tensorflow-gpu:pip install tensorflow-gpu -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
    keras: pip install keras -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
  2. 执行import tensorflow/keras 出现问题:Failed to load the native TensorFlow runtime
  3. 不卸载,继续使用 conda 继续安装 tensorflow:
    conda install tensorflow
    注:查看packages:conda list、还原默认源:conda config --remove-key channels
    为 conda 添加清华镜像源方便下载:
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    conda config --set show_channel_urls yes
  4. 执行import tensorflow 出现新问题:UserWarning: h5py is running against HDF5 1.10.5 when it was built against 1.10.4, this may cause problems
    执行conda install hdf5=1.10.4之类命令没效果;
  5. 解决:
    pip uninstall h5py
    pip install h5py
    执行import tensorflowimport keras不再报错;

你可能感兴趣的:(Python)