“pip install unroll”:“python setup.py egg_info”失败,错误代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35991403/
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-19 17:14:45  来源:igfitidea点击:

"pip install unroll": "python setup.py egg_info" failed with error code 1

pythonpippackageinstall

提问by benjaminh

I'm new to Python and have been trying to install some packages with pip.

我是 Python 新手,一直在尝试使用pip.

But pip install unrollgives me

pip install unroll给我

Command "python setup.py egg_info" failed with error code 1 in C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\

命令“python setup.py egg_info”在 C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\ 中失败,错误代码为 1

How can I solve this?

我该如何解决这个问题?

回答by pixis

About the error code

关于错误代码

According to the Python documentation:

根据Python 文档

This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.

该模块提供标准的 errno 系统符号。每个符号的值是对应的整数值。名称和描述是从 linux/include/errno.h 借来的,它应该是包罗万象的。

Error code 1 is defined in errno.hand means Operation not permitted.

错误代码 1 在errno.h和 中定义Operation not permitted

About your error

关于你的错误

Your setuptoolsdo not appear to be installed. Just follow the Installation Instructionsfrom the PyPI website.

您的setuptools似乎没有安装。只需按照Installation InstructionsPyPI 网站上的 。

If it's already installed, try

如果已经安装,请尝试

pip install --upgrade setuptools

If it's already up to date, check that the module ez_setup is not missing. If it is, then

如果它已经是最新的,请检查模块 ez_setup 是否没有丢失。如果是,那么

pip install ez_setup

Then try again

然后再试一次

pip install unroll

If it's still not working, maybe pip didn't install/upgrade setup_tools properly so you might want to try

如果它仍然不起作用,也许 pip 没有正确安装/升级 setup_tools 所以你可能想尝试

easy_install -U setuptools

And again

然后再次

pip install unroll

回答by BPL

Here's a little guide explaining a little bit how I usually install new packages on Python + Windows. It seems you're using Windows paths, so this answer will stick to that particular SO:

这是一个小指南,解释了我通常如何在 Python + Windows 上安装新软件包。看来您正在使用 Windows 路径,所以这个答案将坚持那个特定的 SO:

  • I never use a system-wide Python installation. I only use virtualenvs, and usually I try to have the latest version of 2.x & 3.x.
  • My first attempt is always doing pip install package_i_wantin some of my Visual Studio command prompts. What Visual Studio command prompt? Well, ideally the Visual Studio which matches the one which was used to build Python. For instance, let's say your Python installation says Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32. The version of Visual Studio used to compile Python can be found here, so v1500 means I'd be using vs2008 x64 command prompt
  • If the previous step failed for some reason I just try using easy_install package_i_want
  • If the previous step failed for some reason I go to gohlke websiteand I check whether my package is available over there. If it's so, I'm lucky, I just download it into my virtualenv and then I just go to that location using a command prompt and I do pip install package_i_want.whl
  • If the previous step didn't succeed I'll just try to build the wheel myself and once it's generated I'll try to install it with pip install package_i_want.whl
  • 我从不使用系统范围的 Python 安装。我只使用 virtualenvs,通常我尝试使用最新版本的 2.x 和 3.x。
  • 我的第一次尝试总是pip install package_i_want在我的一些 Visual Studio 命令提示中进行。什么 Visual Studio 命令提示符?好吧,理想情况下,Visual Studio 与用于构建 Python 的 Visual Studio 相匹配。例如,假设您的 Python 安装显示Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32. 可以在此处找到用于编译 Python 的 Visual Studio 版本,因此 v1500 意味着我将使用 vs2008 x64 命令提示符
  • 如果上一步由于某种原因失败,我只是尝试使用 easy_install package_i_want
  • 如果上一步由于某种原因失败,我会访问gohlke 网站并检查我的包裹是否在那里可用。如果是这样,我很幸运,我只是将它下载到我的 virtualenv 中,然后我就使用命令提示符转到那个位置,然后我就这样做了pip install package_i_want.whl
  • 如果上一步没有成功,我将尝试自己构建轮子,一旦生成,我将尝试安装它 pip install package_i_want.whl

Now, if we focus in your specific problem, where you're having a hard time installing the unrollpackage. It seems the fastest way to install it is doing something like this:

现在,如果我们专注于您的特定问题,您将很难安装unroll软件包。安装它的最快方法似乎是做这样的事情:

  • git clone https://github.com/Zulko/unroll
  • cd unroll && python setup.py bdist_wheel
  • Copy the generated unroll-0.1.0-py2-none-any.whl file from the created dist folder into your virtualenv.
  • pip install unroll-0.1.0-py2-none-any.whl
  • git clone https://github.com/Zulko/unroll
  • cd unroll && python setup.py bdist_wheel
  • 将生成的 unroll-0.1.0-py2-none-any.whl 文件从创建的 dist 文件夹复制到您的 virtualenv 中。
  • pip install unroll-0.1.0-py2-none-any.whl

That way it will install without any problems. To check it really works, just login into the Python installation and try import unroll, it shouldn't complain.

这样它就可以毫无问题地安装。要检查它是否真的有效,只需登录 Python 安装并尝试import unroll,它不应该抱怨。

One last note: This method works almost 99% of the time, and sometimes you'll find some pip packages which are specific to Unix or Mac OS X, in that case, when that happens I'm afraid the best way to get a Windows version is either posting some issues to the main developers or having some fun by yourself porting to Windows (typically a few hours if you're not lucky) :)

最后一个注意事项:此方法几乎在 99% 的时间都有效,有时您会发现一些特定于 Unix 或 Mac OS X 的 pip 包,在这种情况下,当发生这种情况时,恐怕最好的方法是获得Windows 版本要么向主要开发人员发布一些问题,要么自己移植到 Windows 中获得一些乐趣(如果你不走运,通常需要几个小时):)

回答by Lil Ari

It was resolved after upgrading pip:

升级pip后解决:

python -m pip install --upgrade pip
pip install "package-name"

回答by SriSri

I got stuck exactly with the same error with psycopg2. It looks like I skipped a few steps while installing Python and related packages.

我遇到了完全相同的错误psycopg2。看起来我在安装 Python 和相关包时跳过了几个步骤。

  1. sudo apt-get install python-dev libpq-dev
  2. Go to your virtual env
  3. pip install psycopg2
  1. sudo apt-get install python-dev libpq-dev
  2. 转到您的虚拟环境
  3. pip install psycopg2

(In your case you need to replace psycopg2with the package you have an issue with.)

(在您的情况下,您需要替换psycopg2为您遇到问题的包。)

It worked seamlessly.

它无缝地工作。

回答by rashok

I got this same error while installing mitmproxyusing pip3. The below command fixed this:

在安装我得到同样的错误mitmproxy使用pip3。下面的命令修复了这个问题:

pip3 install --upgrade setuptools

回答by be_good_do_good

  • Download and install the Microsoft Visual C++ Compiler for Python 2.7from https://www.microsoft.com/en-in/download/details.aspx?id=44266- this package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.
  • Open a command prompt in elevated mode (run as administrator)
  • Firstly do pip install ez_setup
  • Then do pip install unroll(It will start installing numpy, music21, decorator, imageio, tqdm, moviepy, unroll) # Please be patient for music21installation
  • Microsoft Visual C++ Compiler for Python 2.7https://www.microsoft.com/en-in/download/details.aspx?id=44266下载并安装- 该包包含编译器和为 Python 2.7 包生成二进制轮所需的一组系统头文件。
  • 在提升模式下打开命令提示符(以管理员身份运行)
  • 首先做 pip install ez_setup
  • 然后做pip install unroll(它会开始安装numpy, music21, decorator, imageio, tqdm, moviepy, unroll)#请耐心music21安装

Python 2.7.11 64 bit used

使用 Python 2.7.11 64 位

回答by Thomas Philibert

Other way:

另一种方式:

sudo apt-get install python-psycopg2 python-mysqldb

回答by fadomire

I had the same problem.

我有同样的问题。

The problem was:

问题是

pyparsing 2.2was already installed and my requirements.txtwas trying to install pyparsing 2.0.1which throw this error

pyparsing 2.2已经安装,我requirements.txt正在尝试安装pyparsing 2.0.1哪个抛出这个错误

Context: I was using virtualenv, and it seems the 2.2 came from my global OS Python site-packages, but even with --no-site-packagesflag (now by default in last virtualenv) the 2.2 was still present. Surely because I installed Python from their website and it added Python libraries to my $PATH.

上下文:我使用的是 virtualenv,似乎 2.2 来自我的全局操作系统 Python site-packages,但即使有--no-site-packages标志(现在默认在最后一个 virtualenv 中),2.2 仍然存在。当然是因为我从他们的网站安装了 Python 并将 Python 库添加到我的$PATH.

Maybe a pip install --ignore-installedwould have worked.

也许pip install --ignore-installed会奏效。

Solution: as I needed to move forwards, I just removed the pyparsing==2.0.1from my requirements.txt.

解决方案:因为我需要继续前进,我只是pyparsing==2.0.1从我的requirements.txt.

回答by NP83

I ran into the same error code when trying to install a Python module with pip. @Hackndo noted that the documentation indicate a security issue.

尝试使用 pip 安装 Python 模块时遇到了相同的错误代码。@Hackndo 指出文档表明存在安全问题。

Based on that answer, my problem was solved by running the pip install command with sudo prefixed:

基于那个答案,我的问题是通过运行带有 sudo 前缀的 pip install 命令解决的:

sudo pip install python-mpd2

回答by Adrian Onu

I had the same issue when installing the "Twisted" library and solved it by running the following command on Ubuntu 16.04 (Xenial Xerus):

我在安装“Twisted”库时遇到了同样的问题,并通过在 Ubuntu 16.04 (Xenial Xerus) 上运行以下命令解决了这个问题:

sudo apt-get install python-setuptools python-dev build-essential