Trying to execute easy_install or pip on docker bu

2019-09-12 05:21发布

I am trying to build a docker container based on amazonlinux which is sort of centos.

One of the packages I need is supervisor and it is not available on the official repos so I have to do it with easy_install or pip.

The problem is that, although I tried installing python-setuptools and python-pip, then when I try to do:

RUN easy_install supervisor

or

RUN pip install supervisor

It says the command doesn't exists

/bin/sh: easy_install: command not found
The command '/bin/sh -c easy_install supervisor' returned a non-zero code: 127

I tried with full path, but same result, and I see other dockerfiles people doing it like that on centos images.

2条回答
Melony?
2楼-- · 2019-09-12 06:08

After a while, I found the reason.

By default, yum was installing python26 and the easy_install script runs with python27, so I had to be calling easy_install-2.6 or install the python27 package

查看更多
唯我独甜
3楼-- · 2019-09-12 06:09

Not familiar with AWS's specific image, but for a general centos image, you'll need to install pip or easy_install with a yum command first, which requires the epel repository:

RUN yum -y install epel-release \
 && yum -y install python-pip python-setuptools \
 && yum clean all

Python documented the process in detail on their page here: https://packaging.python.org/install_requirements_linux/

There's also some documentation on this over at superuser: https://superuser.com/q/877759/587488

查看更多
登录 后发表回答