简体   繁体   English

在TeamCity服务器上安装软件包的最佳方法是什么?

[英]What is the best way to install packages on TeamCity server?

I am new to TeamCity and I do not know how to install packages I have imported in my python code on the TeamCity server. 我是TeamCity的新手,我不知道如何在TeamCity服务器上安装以python代码导入的软件包。 For example I have imported selenium in my code and tried to install it using command line on TeamCity by pip install selenium but I got the error pip: command not found . 例如,我已经在代码中导入了selenium ,并试图通过pip install selenium在TeamCity上使用命令行进行pip install selenium但出现了错误pip: command not found I am not sure this is the best way to install needed packages. 我不确定这是安装所需软件包的最佳方法。

It seems like you don't have "pip" (Python package manager) installed on the machine that your Team City agent is running on. 似乎您在Team City代理运行的计算机上没有安装“ pip”(Python软件包管理器)。 Team City does nothing but triggering your builds. Team City只会触发您的构建而已。 In your case, it probably is only resolving dependencies (your Python packages) and running your code. 在您的情况下,它可能仅是解决依赖关系(您的Python包)并运行您的代码。

So you need to install pip on the machine that is running the Team City agent. 因此,您需要在运行Team City代理的计算机上安装pip。 (You might have multiple agents, install pip on all agents that might build this python project) (您可能有多个代理,请在可能构建此python项目的所有代理上安装pip)

You might want to upgrade your Python. 您可能要升级Python。 Python 2.7.9 and later already comes with pip. Python 2.7.9和更高版本已经带有pip。 https://www.python.org/downloads/ https://www.python.org/downloads/

Instruction on how to install pip. 有关如何安装pip的说明。 https://pip.pypa.io/en/latest/installing.html https://pip.pypa.io/zh_CN/latest/installing.html

You can SSH to that machine and run the following bash script (assuming you are on UNIX). 您可以SSH到该计算机并运行以下bash脚本(假设您在UNIX上)。

$ curl https://bootstrap.pypa.io/get-pip.py >> get-pip.py && sudo python get-pip.py

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

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