我正在寻找一种解决方案,允许我安装" http-parser" Python 2.7 32bits和windows 10下的软件包。
但是,pip install http-parser
命令会返回此错误:
Installing collected packages: http-parser
Running setup.py install for http-parser ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\marshall\\appdata\\local\\temp\\pip-install-xjzdsh\\http-parser\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\marshall\appdata\local\temp\pip-record-tmxbux\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\http_parser
copying http_parser\http.py -> build\lib.win32-2.7\http_parser
copying http_parser\pyparser.py -> build\lib.win32-2.7\http_parser
copying http_parser\reader.py -> build\lib.win32-2.7\http_parser
copying http_parser\util.py -> build\lib.win32-2.7\http_parser
copying http_parser\_socketio.py -> build\lib.win32-2.7\http_parser
copying http_parser\__init__.py -> build\lib.win32-2.7\http_parser
running build_ext
building 'http_parser.parser' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\http_parser
C:\msys64\mingw64\bin\gcc.exe -mdll -O -Wall -Iparser -Ic:\python27\include -Ic:\python27\PC -c http_parser\http_parser.c -o build\temp.win32-2.7\Release\http_parser\http_parser.o
C:\msys64\mingw64\bin\gcc.exe -mdll -O -Wall -Iparser -Ic:\python27\include -Ic:\python27\PC -c http_parser\parser.c -o build\temp.win32-2.7\Release\http_parser\parser.o
http_parser\parser.c: In function '__Pyx_RaiseArgtupleInvalid':
http_parser\parser.c:6570:18: warning: unknown conversion type character 'z' in format [-Wformat=]
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
^~~~~~~~~~~~~~~~~
http_parser\parser.c:75:34: note: format string is defined here
#define CYTHON_FORMAT_SSIZE_T "z"
^
http_parser\parser.c:6570:18: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'Py_ssize_t {aka int}' [-Wformat=]
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
^~~~~~~~~~~~~~~~~
http_parser\parser.c:6570:81: note: format string is defined here
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
~^
%d
http_parser\parser.c:6570:18: warning: unknown conversion type character 'z' in format [-Wformat=]
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
^~~~~~~~~~~~~~~~~
http_parser\parser.c:75:34: note: format string is defined here
#define CYTHON_FORMAT_SSIZE_T "z"
^
http_parser\parser.c:6570:18: warning: too many arguments for format [-Wformat-extra-args]
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
^~~~~~~~~~~~~~~~~
http_parser\parser.c: In function '__Pyx_RaiseTooManyValuesError':
http_parser\parser.c:6577:18: warning: unknown conversion type character 'z' in format [-Wformat=]
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http_parser\parser.c:75:34: note: format string is defined here
#define CYTHON_FORMAT_SSIZE_T "z"
^
http_parser\parser.c:6577:18: warning: too many arguments for format [-Wformat-extra-args]
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http_parser\parser.c: In function '__Pyx_RaiseNeedMoreValuesError':
http_parser\parser.c:6582:18: warning: unknown conversion type character 'z' in format [-Wformat=]
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
^~~~~~~~~~~~~~~~~~
http_parser\parser.c:75:34: note: format string is defined here
#define CYTHON_FORMAT_SSIZE_T "z"
^
http_parser\parser.c:6582:18: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t {aka int}' [-Wformat=]
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
^~~~~~~~~~~~~~~~~~
http_parser\parser.c:6582:68: note: format string is defined here
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
~^
%d
http_parser\parser.c:6582:18: warning: too many arguments for format [-Wformat-extra-args]
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
^~~~~~~~~~~~~~~~~~
writing build\temp.win32-2.7\Release\http_parser\parser.def
C:\msys64\mingw64\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\http_parser\http_parser.o build\temp.win32-2.7\Release\http_parser\parser.o build\temp.win32-2.7\Release\http_parser\parser.def -Lc:\python27\libs -Lc:\python27\PCbuild -Lc:\python27\PC\VS9.0 -lpython27 -lmsvcr90 -o build\lib.win32-2.7\http_parser\parser.pyd
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/libpython27.a when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/python27.lib when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs\libpython27.a when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/libpython27.a when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs/python27.lib when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:\python27\libs\python27.lib when searching for -lpython27
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\msys64\\mingw64\\bin\\gcc.exe' failed with exit status 1
这不是我第一次遇到这样的错误(gcc.exe失败,退出状态为1),但每次我都设法通过找到包的可执行文件或滚轮来解决它...
但我真的在这个上找不到任何东西...... :(
自从我遇到这个问题以来已经有几个小时了。 你能帮帮我吗?
SOLUTION:
我必须从http://www.microsoft.com/en-us/download/details.aspx?id=44266
安装Microsoft Visual C ++ Compiler for Python然后我不得不使用命令通过pip安装它。此命令由Anton K
在此问题下提供:
How to use MinGW's gcc compiler when installing Python package using Pip?
这是:pip install --global-option build_ext --global-option --compiler = msvc <package_zip>
这解决了我的问题:)