因为第一次接触深度学习,调试代码时,需要安装TensorFlow,但是安装的时候出现过的问题,这里我想记录下来,提醒我自己 。
首先我打开了Windows命令行,输入安装TensorFlow的命令行如下:
pip install tensorflow -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
然后出现下面的报错提示
第一个坑:
cannot uninstall 'wrapt',it is a distutils installed project and thus we cannot accurately determine which files belong to it would lead to only a partial uninstall
填坑:
是说有一个库现在版本不对,需要卸载重装,但是这个库是distutils安装的,不知道直接卸载能不能正确的卸载干净。这时候如果你确信没问题,可以在pip命令后加上--ignore-installed表示忽略已经安装的库,直接整上新的。这里我也不知道是不是确信没问题,我只好我只能试试这个解决办法。下面我就输入以下代码:
pip install tensorflow --ignore-installed -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
命令框滚动了,你以为安心的解决了这个问题,理想是美好的,但是现实是残酷的。
第二个坑:
error:twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed
然后我就直接安装PyHamcrest包,命令如下:
pip install PyHamcrest -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
然后,没错第三个坑
第三个坑:
Error:could not install packages due to an environmentError:[winError 5] 拒绝访问
是权限问题,这里我就将命令行以管理员权限运行。但是这里使用了报错里面的提示加入了“--user”,命令如下:
pip install tensorflow --user -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
然后成功安装了,但是warning提示没有将某个scipts加入到Path路径中,但是这个路径并不是我anaconda所在的地方,这里有点奇怪,但是警告没问题,只要不是错误,但是我还是把这个加入到的系统的环境变量中了。下面贴一张成功的图片:
还是得耐心,今天装了一晚上,本来都打算放弃了,找另外的电脑跑代码,但是还好我坚持下来了。