python - windows:pip 卸载失败,访问被拒绝
问题描述
我是 Python 新手,正在尝试使用 Jenkinsfile 自动构建 python,为此我正在创建虚拟环境,然后安装pybuilder。但是pybuilder安装因权限问题而失败,
命令:
virtualenv venv
source venv/Scripts/activate
pip install pybuilder
pyb
输出:
+ pip install virtualenv
Collecting virtualenv
Downloading https://.../repository/pypi-public/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl (1.9MB)
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
+ virtualenv --version
16.0.0
+ virtualenv venv
Using base prefix 'f:\\app\\python'
New python executable in ...\venv\Scripts\python.exe
Installing setuptools, pip, wheel...done.
+ source venv/Scripts/activate
++ deactivate nondestructive
++ unset -f pydoc
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -n /usr/bin/sh ']'
++ hash -r
++ '[' -z '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
+++ '[' msys == cygwin ']'
+++ echo .../py/venv
++ VIRTUAL_ENV=.../venv
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH='...'
++ PATH='...'
++ export PATH
++ '[' -z '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ '[' x '!=' x ']'
+++ basename ...
++ PS1='(venv) '
++ export PS1
++ alias pydoc
++ '[' -n /usr/bin/sh ']'
++ hash -r
+ pip --version
pip 18.1 from ...\venv\lib\site-packages\pip (python 3.5)
+ pip install pybuilder
Looking in indexes: https://.../repository/pypi-public/simple
Collecting pybuilder
Downloading https://.../repository/pypi-public/packages/c0/23/57ef070a20ca2ff7852371056a57fef2d95d74b1b99e01bb7200dc7e80e5/pybuilder-0.11.17-py3-none-any.whl (114kB)
Collecting pip<11dev,>=7.1 (from pybuilder)
Downloading https://.../repository/pypi-public/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
Requirement already satisfied: tailer in g:\applications\jenkins\slaves\stcjs3\workspace\py\venv\lib\site-packages (from pybuilder) (0.4.1)
Requirement already satisfied: tblib in g:\applications\jenkins\slaves\stcjs3\workspace\py\venv\lib\site-packages (from pybuilder) (1.3.2)
Collecting setuptools~=39.0.0 (from pybuilder)
Downloading https://.../repository/pypi-public/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl (569kB)
Requirement already satisfied: wheel~=0.31 in ...\venv\lib\site-packages (from pybuilder) (0.32.1)
Installing collected packages: pip, setuptools, pybuilder
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: '...venv\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
在这里,我看到pybuilder下载它自己的pip模块并尝试安装它。由于pip已经安装,它正在尝试卸载当前版本并尝试安装下载的版本,但它失败了。
它失败了,因为pybuilder 安装本身使用pip命令运行并且 pip 尝试杀死自己。
当我对此进行搜索时,我知道它在 Windows 环境中是不可能的:https ://github.com/pypa/pip/issues/3804
Python 版本是 3.5.4。
有人之前遇到过同样的问题吗?
解决方案
推荐阅读
- java - 使用 Eclipse IDE 的 Java 代码问题(初级程序员)
- rss - dpdk19.11 ixgbe rx 队列增加到 22 没有生效,
- oracle - 一旦一个分支在 oracle apex 20.1 中无法执行后执行了其他分支
- multithreading - 使用 Julia 绘制具有多线程、竞争条件问题的 mandelbrot
- android - 如何在android recyclerview中从服务器访问json文件的子文件和子文件
- ruby-on-rails - 在 Rails 中干燥方法调用
- php - laravel,在 forloop 中使用 updateOrCreate
- grafana - 如何在influxdb / grafana中添加多个查询的结果
- bash - vi is hashed to ( 之间有什么区别
) 和 vim 是 ? - google-apps-script - 根据带有宏/脚本的工作表的位置动态更新 rspreadsheet.getRange() 列