Я ищу решение, которое позволило бы мне установить пакет "http-parser" в Python 2.7 32 бит и 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), но каждый раз мне удавалось ее решить путем поиска исполняемого файла или колеса пакета ...
Но я действительно ничего не могу найти по этому поводу ..: (
Прошло несколько часов с тех пор, как я застрял в этой проблеме. Не могли бы вы мне помочь?
РЕШЕНИЕ:
Мне пришлось установить компилятор Microsoft Visual C ++ для Python с http://www.microsoft.com/en-us/download/details.aspx?id=44266
Затем мне пришлось использовать команду дляустановить его через pip. Эта команда была дана Anton K
под этим вопросом:
Как использовать gcc-компилятор MinGW при установке пакета Python с использованием Pip?
Вот оно: pip install --global-option build_ext --global-option --compiler = msvc <package_zip>
Это решило мою проблему:)