尝试了各种方法,最终成功的命令:
pip --default-timeout=100 install --user --upgrade tensorflow
--default-timeout=100 设置时间避免国内下载速度过慢引起超时报错;
install --user --upgrade tensorflow 之前安装的tf版本未卸载直接升级时需要加--user,否则会出现ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\\anaconda\\lib\\site-packages\\~ensorflow\\python\\_pywrap_tensorflow_internal.pyd'
Consider using the `--user` option or check the permissions.