最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - My terminal throws an OSError every time I try to update pip - Stack Overflow

programmeradmin0浏览0评论

I run the command:

python.exe -m pip install --upgrade pip

But when I do I get an OSError saying my access is denied.

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python312\\Lib\\site-packages\\pip\\__init__.py'
Consider using the `--user` option or check the permissions.

How can I update it safely? I have tried downloading the package online but it doesn't work and found other answers saying use sudo but it's not safe.

I run the command:

python.exe -m pip install --upgrade pip

But when I do I get an OSError saying my access is denied.

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python312\\Lib\\site-packages\\pip\\__init__.py'
Consider using the `--user` option or check the permissions.

How can I update it safely? I have tried downloading the package online but it doesn't work and found other answers saying use sudo but it's not safe.

Share Improve this question edited Feb 5 at 14:39 phd 95.1k14 gold badges158 silver badges207 bronze badges asked Feb 4 at 0:43 mdotmdot 456 bronze badges 9
  • 2 Please paste your error messages as code-formatted text instead of screenshots. – Anerdw Commented Feb 4 at 0:47
  • 3 It sounds like you are trying to install into the global Python, which needs admin privileges. You need to either 1) create a venv, or 2) use an admin command prompt. – David Commented Feb 4 at 1:08
  • 2 The first error message is not telling you to update pip; it's complaining about a missing package file and then separately giving you a boilerplate notice that there's a new pip version available. – jjc385 Commented Feb 4 at 1:09
  • Do you have admin priviliedges? – Starship Commented Feb 4 at 1:38
  • @Starship how do i check if i have admin privileges? – mdot Commented Feb 4 at 1:59
 |  Show 4 more comments

1 Answer 1

Reset to default 0

Try opening your command prompt/terminal with administrator privileges

发布评论

评论列表(0)

  1. 暂无评论