繁体   English   中英

找不到Azure Devops发布管道Python模块

[英]Azure Devops Release Pipeline Python Module Not Found

我正在尝试为我的项目配置发布管道。 其中一项工作是一个简单的bash脚本,用于将代码发布到PyPI:

python3 -V

python3 setup.py build && python3 setup.py sdist

twine upload dist/wordsearch*.tar.gz --config-file $(PYPIRC_PATH) 

但是,当我运行创建发行版时,会出现以下错误:

2018-12-13T00:28:28.8474589Z ##[section]Starting: Publish Script
2018-12-13T00:28:28.8478332Z ==============================================================================
2018-12-13T00:28:28.8478459Z Task         : Bash
2018-12-13T00:28:28.8478532Z Description  : Run a Bash script on macOS, Linux, or Windows
2018-12-13T00:28:28.8478635Z Version      : 3.142.2
2018-12-13T00:28:28.8478736Z Author       : Microsoft Corporation
2018-12-13T00:28:28.8478819Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
2018-12-13T00:28:28.8478963Z ==============================================================================
2018-12-13T00:28:29.5748147Z Generating script.
2018-12-13T00:28:29.5751467Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/0e077afa-4419-4ee3-9aa8-c1b9b1f16b85.sh
2018-12-13T00:28:29.5751681Z Python 3.5.2
2018-12-13T00:28:29.7992675Z Traceback (most recent call last):
2018-12-13T00:28:29.8002462Z   File "setup.py", line 17, in <module>
2018-12-13T00:28:29.8002681Z     from setuptools import setup, find_packages
2018-12-13T00:28:29.8003469Z ImportError: No module named 'setuptools'
2018-12-13T00:28:29.8108863Z /home/vsts/work/_temp/0e077afa-4419-4ee3-9aa8-c1b9b1f16b85.sh: line 5: twine: command not found
2018-12-13T00:28:29.8229014Z ##[error]Bash exited with code '127'.
2018-12-13T00:28:29.8257310Z ##[section]Finishing: Publish Script

我收集到的是我缺少setuptools和麻线。 异常之处在于setuptools应该内置在Python库中,但是存在导入错误。

我在脚本之前有一个Twine Authentication作业,并且已经验证setup.py文件存在:

在此处输入图片说明

我是否缺少组件,还是忽略了某些内容? 先感谢您。

为了实现这一点,您将需要使用python -m twine而不是普通的“ twine”命令。 'pip install'将麻线二进制文件放在不在$ PATH上的代理程序上运行的用户位置(类似于/home/vsts/.local/bin)。

对于类似的问题,您可以使用shell命令放置调试步骤,例如find ~ -name twine && echo $PATH

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM