欢迎关注博主的公众号:happyGirl的异想世界。有更多干货还有技术讨论群哦~
升级tf:
对于 GPU 版本: (也可以用pip3)
pip install --upgrade tensorflow-gpu
对于 CPU 版本:
pip install --upgrade tensorflow
在anaconda里更新tensorflow gpu 到指定版本:
pip install -U tensorflow-gpu==1.4
查询版本
用以下语句查
python
import tensorflow as tf
tf.__version__
设置pip conda清华源
pip
清华大学镜像:清华源 pip 需要的版本:https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/
pip源:
临时使用:
pip 后加参数 -i https://pypi.tuna.tsinghua.edu.cn/simple
例1:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
例2:我想安装tensorflow-gpu1.4.1,执行:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==1.4.1
我们可以点进去那个清华链接,这个链接和下面那个conda的清华链接不太一样,注意,有非常多的镜像
永久使用:
Linux下:
修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
windows下:
直接在user目录中创建一个pip目录,如:C:\Users\xxxx\pip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
conda源更改:
conda源国内只有清华有,
修改源只需输入如下两行命令:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
参考: