我正在尝试使用 pip 安装 functools。但我收到以下错误。

Collecting functools
  Using cached functools-0.5.tar.gz
Building wheels for collected packages: functools
  Running setup.py bdist_wheel for functools ... error
  Complete output from command c:\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\TAUSEE~1\\AppData\\Local\\Temp\\pip-build-0gc470iw\\functools\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\TAUSEE~1\AppData\Local\Temp\tmpn0sob7vxpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  copying functools.py -> build\lib.win-amd64-3.5
  running build_ext
  building '_functools' extension
  creating build\temp.win-amd64-3.5
  creating build\temp.win-amd64-3.5\Release
  creating build\temp.win-amd64-3.5\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcsrc\functools.c /Fobuild\temp.win-amd64-3.5\Release\src\functools.obj
  functools.c
  src\functools.c(43): warning C4013: 'Py_InitModule3' undefined; assuming extern returning int
  src\functools.c(43): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
  src\functools.c(45): warning C4033: 'init_functools' must return a value
  src\functools.c(49): warning C4033: 'init_functools' must return a value
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcsrc\compose.c /Fobuild\temp.win-amd64-3.5\Release\src\compose.obj
  compose.c
  src\compose.c(57): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
  src\compose.c(96): error C2039: 'ob_type': is not a member of 'compose'
  src\compose.c(44): note: see declaration of 'compose'
  src\compose.c(137): warning C4013: 'PyString_FromFormat' undefined; assuming extern returning int
  src\compose.c(138): warning C4013: 'PyString_AsString' undefined; assuming extern returning int
  src\compose.c(138): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
  src\compose.c(143): warning C4047: 'initializing': 'Py_ssize_t' differs in levels of indirection from 'char [8]'
  src\compose.c(143): warning C4113: 'destructor' differs in parameter lists from 'printfunc'
  src\compose.c(143): warning C4133: 'initializing': incompatible types - from 'destructor' to 'printfunc'
  src\compose.c(143): warning C4047: 'initializing': 'PyNumberMethods *' differs in levels of indirection from 'reprfunc'
  src\compose.c(143): warning C4113: 'ternaryfunc' differs in parameter lists from 'reprfunc'
  src\compose.c(143): warning C4047: 'initializing': 'const char *' differs in levels of indirection from 'unsigned long'
  src\compose.c(143): warning C4047: 'initializing': 'traverseproc' differs in levels of indirection from 'char *'
  src\compose.c(143): warning C4113: 'traverseproc' differs in parameter lists from 'inquiry'
  src\compose.c(143): warning C4113: 'PyObject *(__cdecl *)(PyObject *,PyObject *)' differs in parameter lists from 'descrsetfunc'
  src\compose.c(143): warning C4047: 'initializing': 'descrsetfunc' differs in levels of indirection from 'PyObject *(__cdecl *)(PyObject *,PyObject *)'
  src\compose.c(143): warning C4113: 'PyObject *(__cdecl *)(PyTypeObject *,PyObject *,PyObject *)' differs in parameter lists from 'freefunc'
  src\compose.c(143): warning C4047: 'initializing': 'freefunc' differs in levels of indirection from 'PyObject *(__cdecl *)(PyTypeObject *,PyObject *,PyObject *)'
  src\compose.c(143): warning C4133: 'initializing': incompatible types - from 'void (__cdecl *)(void *)' to 'inquiry'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for functools
  Running setup.py clean for functools
Failed to build functools
Installing collected packages: functools
  Running setup.py install for functools ... error
    Complete output from command c:\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\TAUSEE~1\\AppData\\Local\\Temp\\pip-build-0gc470iw\\functools\\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\TAUSEE~1\AppData\Local\Temp\pip-z68u1oc7-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    copying functools.py -> build\lib.win-amd64-3.5
    running build_ext
    building '_functools' extension
    creating build\temp.win-amd64-3.5
    creating build\temp.win-amd64-3.5\Release
    creating build\temp.win-amd64-3.5\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcsrc\functools.c /Fobuild\temp.win-amd64-3.5\Release\src\functools.obj
    functools.c
    src\functools.c(43): warning C4013: 'Py_InitModule3' undefined; assuming extern returning int
    src\functools.c(43): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
    src\functools.c(45): warning C4033: 'init_functools' must return a value
    src\functools.c(49): warning C4033: 'init_functools' must return a value
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python35\include -Ic:\python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcsrc\compose.c /Fobuild\temp.win-amd64-3.5\Release\src\compose.obj
    compose.c
    src\compose.c(57): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
    src\compose.c(96): error C2039: 'ob_type': is not a member of 'compose'
    src\compose.c(44): note: see declaration of 'compose'
    src\compose.c(137): warning C4013: 'PyString_FromFormat' undefined; assuming extern returning int
    src\compose.c(138): warning C4013: 'PyString_AsString' undefined; assuming extern returning int
    src\compose.c(138): warning C4047: '=': 'PyObject *' differs in levels of indirection from 'int'
    src\compose.c(143): warning C4047: 'initializing': 'Py_ssize_t' differs in levels of indirection from 'char [8]'
    src\compose.c(143): warning C4113: 'destructor' differs in parameter lists from 'printfunc'
    src\compose.c(143): warning C4133: 'initializing': incompatible types - from 'destructor' to 'printfunc'
    src\compose.c(143): warning C4047: 'initializing': 'PyNumberMethods *' differs in levels of indirection from 'reprfunc'
    src\compose.c(143): warning C4113: 'ternaryfunc' differs in parameter lists from 'reprfunc'
    src\compose.c(143): warning C4047: 'initializing': 'const char *' differs in levels of indirection from 'unsigned long'
    src\compose.c(143): warning C4047: 'initializing': 'traverseproc' differs in levels of indirection from 'char *'
    src\compose.c(143): warning C4113: 'traverseproc' differs in parameter lists from 'inquiry'
    src\compose.c(143): warning C4113: 'PyObject *(__cdecl *)(PyObject *,PyObject *)' differs in parameter lists from 'descrsetfunc'
    src\compose.c(143): warning C4047: 'initializing': 'descrsetfunc' differs in levels of indirection from 'PyObject *(__cdecl *)(PyObject *,PyObject *)'
    src\compose.c(143): warning C4113: 'PyObject *(__cdecl *)(PyTypeObject *,PyObject *,PyObject *)' differs in parameter lists from 'freefunc'
    src\compose.c(143): warning C4047: 'initializing': 'freefunc' differs in levels of indirection from 'PyObject *(__cdecl *)(PyTypeObject *,PyObject *,PyObject *)'
    src\compose.c(143): warning C4133: 'initializing': incompatible types - from 'void (__cdecl *)(void *)' to 'inquiry'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

我之前在安装 resampy 时遇到过这个错误,我通过安装 VS 构建工具解决了它。我还将 vcvarsal.bat 文件添加到变量路径中,最终安装了 resampy。但是 functools 似乎没有安装。我也找不到轮子。我已经粘贴了执行 pip install functools 后得到的整个消息

我正在使用 python 3.5.3
win10 x64

将不胜感激在这个问题上的任何帮助。

最佳答案

functools on python package index 的最后一次更新来自 2005 年。
作为 explained on this SO ,它自 python 2.7 起就被包含在标准库中

关于python - pip install functools 返回错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45434650/

10-12 03:24