教你避过安装TensorFlow的两个坑

TensorFlow作为著名机器学习相关的框架,很多小伙伴们都可能要安装它。WIN+R,输入cmd运行后,通常可能就会pip install tensorflow直接安装了,但是由于这个库比较大,接近500M,加上这个是国外链,特别慢,所以需要镜像网站来帮忙。

1.利用镜像安装:

国内知名的镜像网站有很多,比如清华,豆瓣,阿里的镜像,这里推荐豆瓣的,亲测速度达到3M/s,足够满足需求。只需运行cmd后输入

pip install tensorflow -i https://pypi.douban.com/simple

2.报错:

(建议先试着运行下面的代码,再去安装TensorFlow,免得再安装一次)

如果遇到下面的报错:

ERROR: Cannot uninstall ‘wrapt‘. It is a distutils installed project and thus......

pip install -U --ignore-installed wrapt enum34 simplejson netaddr

如果遇到下面的报错:

ERROR: tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 39.1.0 which is incompatible...

那么可以输入

pip install --upgrade setuptools
最后推荐几个不错的镜像网站,备用:
阿里云 
http://mirrors.aliyun.com/pypi/simple/

中国科技大学 
https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban) 
http://pypi.douban.com/simple/

清华大学 
https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 
http://pypi.mirrors.ustc.edu.cn/simple/

部分参考:https://blog.csdn.net/qq_27512741/article/details/100540148

相关推荐