简体   繁体   English

命令“ python setup.py egg_info”在/ tmp / pip-install-jsegcbha / mysqlclient /中失败,错误代码为1

[英]Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-jsegcbha/mysqlclient/

MacOS High Sierra MacOS高山脉

Python 3.6.3 Python 3.6.3

docker-compose.yml docker-compose.yml

version: '3'
services:
  celery:
    container_name: "cache_bot"
    build:
      context: .
      dockerfile: docker/celery/Dockerfile
    command: "celery -A cache_bot.app worker --loglevel=info"
    volumes:
      - ./src:/www

Dockerfile Docker文件

FROM python:3.6-alpine

RUN apk --update add --no-cache bash gcc libc-dev unixodbc-dev python3-dev

ADD ./src /www
ADD ./requirements.txt /home

WORKDIR /www

RUN pip install -r /home/requirements.txt

requirements.txt requirements.txt

mysqlclient==1.3.12
...

When I run command 'docker-compose build' I get the error: 当我运行命令“ docker-compose build”时,出现错误:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-jsegcbha/mysqlclient/ 命令“ python setup.py egg_info”在/ tmp / pip-install-jsegcbha / mysqlclient /中失败,错误代码为1

ERROR: Service 'celery' failed to build: The command '/bin/sh -c pip install -r /home/requirements.txt' returned a non-zero code: 1 错误:服务“ celery”构建失败:命令“ / bin / sh -c pip install -r /home/requirements.txt”返回非零代码:1

Full traceback: 完整回溯:

Collecting mysqlclient==1.3.12 (from -r /home/requirements.txt (line 8)) 收集mysqlclient == 1.3.12(从-r /home/requirements.txt(第8行))

Downloading https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz (89kB) 正在下载https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz(89kB

Complete output from command python setup.py egg_info: 来自命令python setup.py egg_info的完整输出:

/bin/sh: mysql_config: not found / bin / sh:mysql_config:找不到

Traceback (most recent call last): 追溯(最近一次通话):

File "/tmp/pip-install-jsegcbha/mysqlclient/setup.py", line 17, in metadata, options = get_config() 文件“ /tmp/pip-install-jsegcbha/mysqlclient/setup.py”,第17行,元数据中,options = get_config()

File "/tmp/pip-install-jsegcbha/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") 在get_config libs = mysql_config(“ libs_r”)中的文件“ /tmp/pip-install-jsegcbha/mysqlclient/setup_posix.py”,第44行

File "/tmp/pip-install-jsegcbha/mysqlclient/setup_posix.py", line 26, in mysql_config 在mysql_config中的文件“ /tmp/pip-install-jsegcbha/mysqlclient/setup_posix.py”,第26行

raise EnvironmentError("%s not found" % (mysql_config.path,)) 引发EnvironmentError(“找不到%s”%(mysql_config.path,))

OSError: mysql_config not found OSError:找不到mysql_config

Actually, mysql_config is by path /usr/local/bin and this path is set up in $PATH 实际上,mysql_config是通过/ usr / local / bin路径,并且此路径是在$ PATH中设置的

I've tried - RUN pip install --upgrade setuptools - in my Dockerfile. 我已经尝试过-在我的Dockerfile中运行RUN pip install --upgrade setuptools。 It did not help. 它没有帮助。

ENV PATH /usr/local/bin:$PATH in Dockerfile did not help as well. Dockerfile中的ENV PATH / usr / local / bin:$ PATH也没有帮助。

Thanks a lot!!!!!!!!!!!!! 非常感谢!!!!!!!!!!!!!

I had the same issue try this on the command line 我遇到了同样的问题,在命令行上尝试

brew install mysql-connector-c
brew install mysql
brew unlink mysql-connector-c
sudo pip install pymysql
sudo pip install mysqlclient

The problem is in your Dockerfile the python:3.6-alpine is a reduced version of Python and the mysqlclient is looking for a development headers and libraries. 问题出在您的Dockerfilepython:3.6-alpine是Python的简化版本,而mysqlclient正在寻找开发标头和库。

It is the official page Pypi: mysqlclient 这是Pypi的官方页面:mysqlclient

Prerequisites: You may need to install the Python and MySQL development headers and libraries... 先决条件:您可能需要安装Python和MySQL开发标头和库...

My solution: 我的解决方案:

In my case I had the slim version and I changed to a Python 3 (3.7) and it works. 在我的情况下,我有一个苗条的版本,我改成了Python 3(3.7),它可以工作。

#FROM python:3-slim
FROM python:3

暂无
暂无

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

相关问题 命令“python setup.py egg_info”在 /tmp/pip-install-fs0wmmw4/mysqlclient/ 中失败,错误代码为 1 - Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fs0wmmw4/mysqlclient/ 命令“ python setup.py egg_info”在/ tmp / pip-build-hg0dbjgz / mysqlclient /中失败,错误代码为1 - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-hg0dbjgz/mysqlclient/ / tmp / pip-install-rJRUpL / pyfinite /中的命令“ python setup.py egg_info”失败,错误代码为1 - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-rJRUpL/pyfinite/ 命令“ python setup.py egg_info”在/ tmp / pip-install-8ryfpf0v / unroll /中失败,错误代码为1 - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-8ryfpf0v/unroll/ ctcdecode 安装失败 - 命令“python setup.py egg_info”在 /tmp/pip-req-build-7zcjual1/ 中失败,错误代码为 1 - ctcdecode install fail - Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-7zcjual1/ 命令“python setup.py egg_info”失败,错误代码 1 在 /tmp/pip-install-mqa_uywo/grpcio/ - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-mqa_uywo/grpcio/ 命令“python setup.py egg_info”在 /tmp/pip-install-xaum7z8f/supervisor/ 中失败,错误代码为 1 - Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xaum7z8f/supervisor/ / tmp / pip-install-_p77_6kw / poster /中的命令“ python setup.py egg_info”失败,错误代码为1 - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-_p77_6kw/poster/ 命令“python setup.py egg_info”失败,错误代码 1 在 /tmp/pip-install-xtrlkujj/pyaudio/ - Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-xtrlkujj/pyaudio/ Python pip安装给出“命令”“ python setup.py egg_info”失败,错误代码为1” - Python pip install gives “Command ”python setup.py egg_info“ failed with error code 1”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM