python的pip安装包时的错误Could not install packages due to anEnvironmentError: [WinError 5] 拒绝访问..

问题

我这样安装tensorflow:

pip install --upgrade tensorflow

如图:
在这里插入图片描述
原因:安装东西到C盘没有权限

解决

解决方法:添加 --user

pip install --upgrade   --user  tensorflow-gpu

成功:
在这里插入图片描述

安装成功此时我遇到了下面的警告:WARNING: The scripts estimator_ckpt_converter.exe, import_pb_to_tensorboard.exe, saved_model_cli.exe, tensorboard.exe, tf_upgrade_v2.exe, tflite_convert.exe, toco.exe and toco_from_protos.exe are installed in ‘C:\Users\hp\AppData\Roaming\Python\Python37\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location

解决方法:根据提示把路径C:\Users\hp\AppData\Roaming\Python\Python37\Scripts添加到环境变量即可。

猜你喜欢

转载自blog.csdn.net/weixin_46211269/article/details/125813248