本文翻译自:“pip install unroll”: “python setup.py egg_info” failed with error code 1
I'm new to Python and have been trying to install some packages with pip
. 我是Python的新手,一直在尝试使用pip
安装一些软件包。
But pip install unroll
gives 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? 我该如何解决?
#1楼
参考:https://stackoom.com/question/2R10V/pip-install-unroll-python-setup-py-egg-info-失败-错误代码为
#2楼
About the error code 关于错误代码
According to the Python documentation : 根据Python文档 :
This module makes available standard errno system symbols. 该模块提供了可用的标准errno系统符号。 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. 名称和描述是从linux / include / errno.h借来的 ,应该十分全面。
Error code 1 is defined in errno.h
and means Operation not permitted
. 错误代码1在errno.h
定义,表示Operation not permitted
。
About your error 关于您的错误
Your setuptools do not appear to be installed. 您的setuptools似乎未安装。 Just follow the Installation Instructions
from the PyPI website. 只需按照PyPI网站上的Installation Instructions
。
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. 如果已经更新,请检查模块ez_setup是否缺失。 If it is, then 如果是的话
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
#3楼
Here's a little guide explaining a little bit how I usually install new packages on Python + Windows. 这是一些指南,解释了我通常如何在Python + Windows上安装新软件包。 It seems you're using Windows paths, so this answer will stick to that particular SO: 似乎您正在使用Windows路径,因此此答案将遵循特定的SO:
- I never use a system-wide Python installation. 我从不使用系统范围的Python安装。 I only use virtualenvs, and usually I try to have the latest version of 2.x & 3.x. 我只使用virtualenvs,通常我会尝试使用最新版本的2.x和3.x。
- My first attempt is always doing
pip install package_i_want
in some of my Visual Studio command prompts. 我的第一个尝试总是在某些Visual Studio命令提示符中执行pip install package_i_want
。 What Visual Studio command prompt? 什么Visual Studio命令提示符? Well, ideally the Visual Studio which matches the one which was used to build Python. 好吧,理想情况下是与用来构建Python的Visual Studio相匹配的Visual Studio。 For instance, let's say your Python installation saysPython 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
. 例如,假设您的Python安装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 可以在这里找到用于编译Python的Visual Studio版本,因此v1500表示我将使用vs2008 x64命令提示符 - If the previous step failed for some reason I just try using
easy_install package_i_want
如果上一步由于某种原因而失败,我只是尝试使用easy_install package_i_want
- If the previous step failed for some reason I go to gohlke website and I check whether my package is available over there. 如果上一步由于某种原因失败了,请访问gohlke网站,然后检查我的包裹是否在那儿。 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
如果是这样,我很幸运,我将其下载到virtualenv中,然后使用命令提示符转到该位置,然后执行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
如果上一步没有成功,我将尝试自己构建轮子,一旦生成,我将尝试使用pip install package_i_want.whl
Now, if we focus in your specific problem, where you're having a hard time installing the unroll package. 现在,如果我们专注于您的特定问题,那么您将很难安装展开软件包。 It seems the fastest way to install it is doing something like this: 似乎最快的安装方式是执行以下操作:
-
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. 将创建的dist文件夹中生成的unroll-0.1.0-py2-none-any.whl文件复制到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上获得了一些乐趣(如果不走运,通常需要几个小时):)
#4楼
- Download and install the
Microsoft Visual C++ Compiler for Python 2.7
from 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. 从https://www.microsoft.com/zh-cn/download/details.aspx?id=44266下载并安装Microsoft Visual C++ Compiler for Python 2.7
的Microsoft Visual C++ Compiler for Python 2.7
-此程序包包含生成二进制文件所必需的编译器和系统标头集适用于Python 2.7软件包的轮子。 - Open a command prompt in elevated mode (run as administrator) 在提升模式下打开命令提示符(以管理员身份运行)
- Firstly do
pip install ez_setup
首先做pip install ez_setup
- Then do
pip install unroll
(It will start installingnumpy, music21, decorator, imageio, tqdm, moviepy, unroll
) # Please be patient formusic21
installation 然后做pip install unroll
(它将开始安装numpy, music21, decorator, imageio, tqdm, moviepy, unroll
)#请耐心安装music21
Python 2.7.11 64 bit used 使用python 2.7.11 64位
#5楼
另一种方式:
sudo apt-get install python-psycopg2 python-mysqldb
#6楼
I tried all of the above with no success. 我尝试了以上所有方法,但均未成功。 I then updated my Python version from 2.7.10 to 2.7.13, and it resolved the problems that I was experiencing. 然后,我将Python版本从2.7.10更新到2.7.13,它解决了我遇到的问题。