我正在尝试用pip安装一些软件包。

但pip安装展开给我

命令“python setup.py egg_info”失败,错误码为1 C:\Users\马可的~ 1 \ AppData \ \ Temp \ pip-build-wa7uco0k \展开\

我怎么解决这个问题?


当前回答

我有同样的问题,并能够通过执行以下操作来解决。

Windows Python需要通过SDK安装Visual c++库来构建代码,例如通过setuptools.extension.Extension或numpy.distutils.core.Extension。例如,在Windows中使用Python构建f2py模块需要上面安装的Visual c++ SDK。在Linux和Mac上,c++库与编译器一起安装。

https://www.scivision.co/python-windows-visual-c++-14-required/

其他回答

关于错误码

根据Python文档:

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

错误代码1定义在errno.h中,表示不允许操作。

关于你的错误

您的setuptools似乎没有安装。只需遵循PyPI网站上的安装说明。

如果已经安装,请尝试

pip install --upgrade setuptools

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

pip install ez_setup

然后再试一次

pip install unroll

如果它仍然不工作,可能pip没有正确安装/升级setup_tools,所以您可能想尝试一下

easy_install -U setuptools

一次又一次

pip install unroll

对我来说这很有效

python3 -m pip3 install -U pip

你也可以试试

python -m pip install -U pip

接下来的安装帮助我:

pip3 install cython

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. 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 music21 installation

Python 2.7.11使用64位

下面是一个小指南,解释了我通常是如何在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_want in 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 website and 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

现在,如果我们关注你的具体问题,你在安装展开包时遇到了困难。似乎安装它的最快方法是这样做:

git克隆https://github.com/Zulko/unroll CD展开&& 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

这样安装就不会出现任何问题。要检查它是否真的工作,只需登录到Python安装并尝试导入展开,它应该不会报错。

最后一点:这种方法99%的情况下都是有效的,有时候你会发现一些针对Unix或Mac OS X的pip包,在这种情况下,我想获得Windows版本的最好方法是向主要开发人员发布一些问题,或者自己进行一些有趣的移植到Windows(通常是几个小时,如果你运气不好的话):)