python, conda: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'd:\\anaconda3\\envs\\python39\\scripts\\pip.exe'
python, conda: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'd:\\anaconda3\\envs\\python39\\scripts\\pip.exe'
我尝试使用 pip install -r requirements.txt
安装 requirements.txt
。我总是收到此错误:
Using cached ansicon-1.89.0-py2.py3-none-any.whl (63 kB)
Installing collected packages: ansicon, wcwidth, six, jinxed, urllib3, readchar, python-editor, python-dateutil, jmespath, idna, chardet, certifi, blessed, requests, pyyaml, pip, mypy-extensions, inquirer, click, botocore, attrs, rollbar, redis, chalice
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'd:\anaconda3\envs\python39\scripts\pip.exe'
Consider using the `--user` option or check the permissions.
Note that I am using windows 10 as OS.
我发现安装过程 “从脚本中删除了我的 pip 脚本”,这就是为什么我 运行 pip install -r requirements.txt --user
我得到了
Cannot open D:\anaconda3\envs\python39\Scripts\pip-script.py
我也试过升级 pip 但不能
Cannot open D:\anaconda3\envs\python39\Scripts\pip-script.py
对于那些可能会说首先尝试通过 conda 安装 pip 的人,我得到:
$ conda install pip
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.10.1
latest version: 4.10.3
Please update conda by running
$ conda update -n base -c defaults conda
# All requested packages already installed.
我有 运行 作为管理员的命令,我在 conda
中尝试了 python 的许多版本。我还全局安装了 python(一旦我重新启动系统,全局 python 文件夹就会消失)。我还尝试使用 conda 安装需求文件,但在 conda 或 conda forge 通道中找不到 chalice
和 rollbar
。
这是我的requirements.txt
chalice==1.23.0
requests==2.25.1
rollbar==0.15.2
redis==3.5.3
我该如何解决这个问题?
由于安装丢失的脚本,使用这个:python -m ensurepip --default-pip
更多可以查看this
您也可以在 GitHub here
上查看此问题
什么是 ensurepip 以及何时使用它?
ensurepip
是一个支持 pip
引导的包。当由于某种原因跳过安装 pip 时使用它。来自文档:
In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip.
我尝试使用 pip install -r requirements.txt
安装 requirements.txt
。我总是收到此错误:
Using cached ansicon-1.89.0-py2.py3-none-any.whl (63 kB)
Installing collected packages: ansicon, wcwidth, six, jinxed, urllib3, readchar, python-editor, python-dateutil, jmespath, idna, chardet, certifi, blessed, requests, pyyaml, pip, mypy-extensions, inquirer, click, botocore, attrs, rollbar, redis, chalice
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'd:\anaconda3\envs\python39\scripts\pip.exe'
Consider using the `--user` option or check the permissions.
Note that I am using windows 10 as OS.
我发现安装过程 “从脚本中删除了我的 pip 脚本”,这就是为什么我 运行 pip install -r requirements.txt --user
我得到了
Cannot open D:\anaconda3\envs\python39\Scripts\pip-script.py
我也试过升级 pip 但不能
Cannot open D:\anaconda3\envs\python39\Scripts\pip-script.py
对于那些可能会说首先尝试通过 conda 安装 pip 的人,我得到:
$ conda install pip
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.10.1
latest version: 4.10.3
Please update conda by running
$ conda update -n base -c defaults conda
# All requested packages already installed.
我有 运行 作为管理员的命令,我在 conda
中尝试了 python 的许多版本。我还全局安装了 python(一旦我重新启动系统,全局 python 文件夹就会消失)。我还尝试使用 conda 安装需求文件,但在 conda 或 conda forge 通道中找不到 chalice
和 rollbar
。
这是我的requirements.txt
chalice==1.23.0
requests==2.25.1
rollbar==0.15.2
redis==3.5.3
我该如何解决这个问题?
由于安装丢失的脚本,使用这个:python -m ensurepip --default-pip
更多可以查看this
您也可以在 GitHub here
什么是 ensurepip 以及何时使用它?
ensurepip
是一个支持 pip
引导的包。当由于某种原因跳过安装 pip 时使用它。来自文档:
In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip.