我有一个Windows Jenkins工人,它有一个可嵌入的Python,它需要在上面安装一些软件包。python已经有pip了,使用get-pip.py安装。我还修改了python38._pth,如另一篇SO帖子所示:
python38.zip
.
Lib
Lib/site-packages
# Uncomment to run site.main() automatically
#import site
不知道这是否有帮助,但管道的相关部分是:
dir('env'){
bat '''
.\\python.exe -m pip config --user set global.extra-index-url "<url>"
.\\python.exe -m pip install -r requirements.txt --force-reinstall
.\\python.exe -m pip list
'''
}
当使用python 3.8.9时,pipeline给出以下错误:
ERROR: Exception:
Traceback (most recent call last):
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\cli\base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\commands\install.py", line 452, in run
installed = install_given_reqs(
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\req\__init__.py", line 72, in install_given_reqs
requirement.install(
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\req\req_install.py", line 780, in install
scheme = get_scheme(
File "D:\jenkins\workspace\<repo-name_><branch-name>\env\Lib/site-packages\pip\_internal\locations\__init__.py", line 249, in get_scheme
old = _distutils.get_scheme(
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\locations\_distutils.py", line 141, in get_scheme
scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix)
File "D:\jenkins\workspace\<repo-name>_<branch-name>\env\Lib/site-packages\pip\_internal\locations\_distutils.py", line 80, in distutils_scheme
i.finalize_options()
File "distutils\command\install.py", line 344, in finalize_options
File "distutils\command\install.py", line 487, in convert_paths
File "distutils\util.py", line 122, in convert_path
ValueError: path '/scratch/data/jenkins/workspace/<repo-name>_<branch-name>_tmp/.local' cannot be absolute
奇怪的是,我还尝试了python 3.10的嵌入式和完全相同的管道,在那个版本上,它没有任何问题。
这是我第一次使用Jenkins,所以如果我看起来有点迷路,请道歉。任何帮助都将不胜感激
1条答案
按热度按时间3b6akqbq1#
看来我的错误是在管道中将PYTHONUSERBASE定义为环境变量。即使使用pip和嵌入式python将软件包单独放在本地site-packages目录中,变量似乎会干扰这个过程。(我假设在试图弄清楚在哪里安装软件包时)