命令 python setup.py egg_info 失败,错误代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21517051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:02:57  来源:igfitidea点击:

Command python setup.py egg_info failed with error code 1

pythonpip

提问by Patrick Yan

I am trying to do make install, but I keep getting an error. I already tried following this answer: Can't install via pip because of egg_info error

我正在尝试这样做make install,但我不断收到错误消息。我已经尝试过以下这个答案:由于 egg_info 错误,无法通过 pip 安装

Command python setup.py egg_info failed with error code 1 in /abc/abc_env/build/MySQL-python
Storing debug log for failure in /Users/Pat/.pip/pip.log

the full debug log: http://pastebin.com/cnGgWU4G

完整的调试日志:http: //pastebin.com/cnGgWU4G

Here's the Makefile:

这是生成文件:

virtualenv-2.7 my_env && \
source my_env/bin/activate && \
pip install -r requirements.txt

It looks like the problem only happens in the virtual environment. I am able to do pip install mysql-pythonwithout a problem, but pip install -r requirements.txthas errors when trying to install mysql-python

看起来问题只发生在虚拟环境中。我可以pip install mysql-python毫无问题pip install -r requirements.txt地安装,但在尝试安装时出现错误mysql-python

requirements.txt below:

要求.txt如下:

Flask==0.10.1
Jinja2==2.7.1
MarkupSafe==0.18
MySQL-python==1.2.4
PyYAML==3.10
SQLAlchemy==0.8.3
Tempita==0.5.1
Werkzeug==0.9.4
argparse==1.2.1
dataset==0.3.13
decorator==3.4.0
docopt==0.4.0
itsdangerous==0.23
mandrill==1.0.53
mysql-connector-python==1.0.12
requests==2.0.1
sqlalchemy-migrate==0.7.2
wsgiref==0.1.2

采纳答案by Patrick Yan

There were several problems with the original code.

原始代码有几个问题。

First, MySQL-pythonversion 1.2.4for some reason fails to install. Changing this to 1.2.5fixes that error.

首先,MySQL-python版本1.2.4由于某种原因无法安装。更改此设置以1.2.5修复该错误。

Second, argparsecannot be installed as is. It needs --allow-all-external. The new Makefile is below:

其次,argparse不能按原样安装。它需要--allow-all-external. 新的 Makefile 如下:

virtualenv-2.7 my_env && \
source my_env/bin/activate && \
pip install -r requirements.txt --allow-all-external

Third, mysql-connector-pythonversion 1.0.12doesn't exist. Changing it to 1.1.4worked.

第三,mysql-connector-python版本1.0.12不存在。将其更改为1.1.4有效。

回答by Kumar Nitin

If above answer do not do the trick. Try the following.

如果上面的答案不做伎俩。请尝试以下操作。

  1. Install the MySQL. (http://dev.mysql.com/downloads/)
  2. Add the path. export PATH=${PATH}:/usr/local/mysql/bin
  1. 安装 MySQL。( http://dev.mysql.com/downloads/)
  2. 添加路径。导出 PATH=${PATH}:/usr/local/mysql/bin

Now, run pip install -r requirements.txt

现在,运行 pip install -r requirements.txt

回答by baby maneesha Sunkara

try this

尝试这个

sudo apt-get install libmysqlclient-dev