安装divisi2时,使用Visual C++ for Python失败,退出状态为2。

5

我正在使用 Windows 8.1 64 位系统和 Python 2.7。

我想要安装divisi2

我已经安装了 divisi2 的前置依赖 NumPy 和 SciPy。我也已经安装了适用于 Python 9.0 的 Visual C++。

当我输入 pip install divisi2 命令时,控制台会显示以下错误信息。


    svdlib/svdwrapper.c(89) : error C2059: syntax error : '{'
    svdlib/svdwrapper.c(90) : error C2275: 'PyObject' : illegal use of this type as an expression c:\python27\include\object.h(108) : see declaration of 'PyObject'
    svdlib/svdwrapper.c(90) : error C2065: 'arr' : undeclared identifier
    svdlib/svdwrapper.c(90) : error C2065: 'type' : undeclared identifier
    svdlib/svdwrapper.c(90) : warning C4047: 'function' : 'PyArray_Descr *' differs in levels of indirection from 'int'
    svdlib/svdwrapper.c(90) : warning C4024: 'function through pointer' : different types for formal and actual parameter 2
    svdlib/svdwrapper.c(91) : error C2065: 'dim' : undeclared identifier
    svdlib/svdwrapper.c(91) : warning C4047: 'function' : 'npy_intp *' differs in levels of indirection from 'int'
    svdlib/svdwrapper.c(91) : warning C4024: 'function through pointer' : different types for formal and actual parameter 4
    svdlib/svdwrapper.c(91) : error C2065: 'strides' : undeclared identifier
    svdlib/svdwrapper.c(91): warning C4047: 'function' : 'npy_intp *' differs in levels of indirection from 'int'
    svdlib/svdwrapper.c(91): warning C4024: 'function through pointer': different types for formal and actual parameter 5
    svdlib/svdwrapper.c(95) : error C2065: 'arr' : undeclared identifier
    svdlib/svdwrapper.c(96): error C2065: 'arr': undeclared identifier
    svdlib/svdwrapper.c(96): warning C4047: 'return': 'int *' differs in levels of indirection from 'int'
    svdlib/svdwrapper.c(100) : error C2143: syntax error : missing '{' before '*'
    svdlib/svdwrapper.c(102) : warning C4133: 'initializing' : incompatible types - from 'int *' to 'PyObject *'
    svdlib/svdwrapper.c(114) : warning C4133: 'return' : incompatible types - from 'PyObject *' to 'int *'
    error: command 'C:\\Users\\i054564\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\i054564\\appdata\\local\\temp\\pip-build-0aufqt\\divisi2\\setup.py';exec
(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),
    __file__, 'exec'))" install --record c:\users\i054564\appdata\local\temp\pip-5dxl7g-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\i054564\appdata\local\temp\pip-build-0aufqt\divisi2\
3个回答

4

3
在安装pycocotools时,我遇到了这个问题。 Python 2.7不兼容或不支持编译C99代码所需的Visual C++ 14。
这就是编译错误(C2065、C4047等)的原因。
你需要:
1. 安装Visual Studio 2015构建工具(这将安装C++ 14编译器)。 2. 安装新版本的Python(推荐3.6以上版本)。
更多���于Python的Windows编译器信息,请查看这里enter image description here

5
Python 3.8怎么样? - Ali

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接