【问题标题】:Anaconda Python2.7 compiling packages error on Windows 7Anaconda Python2.7 在 Windows 7 上编译包错误
【发布时间】:2017-02-11 22:20:41
【问题描述】:

尝试安装,pip install spacy 还做了 conda install mingw

D:\Programms\Anaconda2\Scripts>gcc -v 使用内置规范。 COLLECT_GCC=D:\Programms\Anaconda2\Scripts\gcc.bat....\MinGW\bin\gcc.exe COLLECT_LTO_WRAPPER=d:/programms/anaconda2/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lto-wrapper.exe 目标:x86_64-w64-mingw32 配置:../../../build/gcc/src/configure --target=x86_64-w64-mingw32 --prefix=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build /ro ot --with-sysroot=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root --enable-languages=all,obj-c++ --enable-fully-dynamic-string --dis 能多库 线程型号:win32 gcc 版本 4.7.0 20111220(实验性)(GCC)

出错了。像 MinGW 和 Visual C++ 混用的锁

d:\Programms\Anaconda2\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -Id:\programms\anaconda2\include -Ic:\users\runa\appdata\local\temp\pip-b uild-pgrnrn\spacy\include -Ic:\users\runa\appdata\local\temp\pip-build-pgrnrn\spacy\include\msvc9 -Id:\programms\anaconda2\include -Id:\prog ramms\anaconda2\PC -c spacy/parts_of_speech.cpp -o build\temp.win-amd64-2.7\Release\spacy\parts_of_speech.o -O3 -Wno-strict-prototypes -Wno- 未使用的功能 cc1plus.exe:警告:命令行选项“-Wno-strict-prototypes”对 C/ObjC 有效,但对 C++ 无效 [默认启用] spacy/parts_of_speech.cpp:在函数“void __Pyx_RaiseTooManyValuesError(Py_ssize_t)”中: spacy/parts_of_speech.cpp:1947:94:警告:未知转换类型字符“z”格式为 [-Wformat] spacy/parts_of_speech.cpp:1947:94:警告:格式参数过多 [-Wformat-extra-args] spacy/parts_of_speech.cpp:在函数'void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t)'中: spacy/parts_of_speech.cpp:1953:48:警告:未知转换类型字符“z”格式为 [-Wformat] spacy/parts_of_speech.cpp:1953:48:警告:格式“%s”需要“char*”类型的参数,但参数 3 的类型为“Py_ssize_t {aka long lo ng int}' [-Wformat] spacy/parts_of_speech.cpp:1953:48:警告:格式参数过多 [-Wformat-extra-args] 编写 build\temp.win-amd64-2.7\Release\spacy\parts_of_speech.def d:\Programms\Anaconda2\Scripts\g++.bat -DMS_WIN64 -shared -s build\temp.win-amd64-2.7\Release\spacy\parts_of_speech.o build\temp.win-amd64 -2.7\Release\spacy\parts_of_speech.def -Ld:\programms\anaconda2\libs -Ld:\programms\anaconda2\PCbuild\amd64 -Ld:\programms\anaconda2\PC\VS9。 0\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\spacy\parts_of_speech.py​​d 构建“spacy.strings”扩展 d:\Programms\Anaconda2\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -Id:\programms\anaconda2\include -Ic:\users\runa\appdata\local\temp\pip-b uild-pgrnrn\spacy\include -Ic:\users\runa\appdata\local\temp\pip-build-pgrnrn\spacy\include\msvc9 -Id:\programms\anaconda2\include -Id:\prog ramms\anaconda2\PC -c spacy/strings.cpp -o build\temp.win-amd64-2.7\Release\spacy\strings.o -O3 -Wno-strict-prototypes -Wno-unused-function cc1plus.exe:警告:命令行选项“-Wno-strict-prototypes”对 C/ObjC 有效,但对 C++ 无效 [默认启用] 在 spacy/strings.cpp:248:0 包含的文件中: c:\users\runa\appdata\local\temp\pip-build-pgrnrn\spacy\include\msvc9/stdint.h:34:2: 错误:#error“仅将此标头用于 Microsoft Visual C++ 编译器!” 在 c:\users\runa\appdata\local\temp\pip-build-pgrnrn\spacy\include/murmurhash/MurmurHash3.h:8:0 包含的文件中, cc1plus.exe:警告:命令行选项“-Wno-strict-prototypes”对 C/ObjC 有效,但对 C++ 无效 [默认启用] 在thinc/linalg.cpp:248:0 包含的文件中: c:\users\runa\appdata\local\temp\pip-build-pgrnrn\thinc\include\msvc9/stdint.h:34:2: error: #error "仅在 Microsoft Vi 中使用此标头 sual C++ 编译器!” 错误:命令 'd:\Programms\Anaconda2\Scripts\gcc.bat' 失败,退出状态 薄薄的建筑轮子失败 为 Thinc 运行 setup.py clean 未能建造 spacy Thinc 安装收集的包:thinc、pathlib、semver、sputnik、ujson、spacy

我跳过的所有输出列表

运行 setup.py install for Thinc ... 错误 命令 d:\programms\anaconda2\python.exe -u -c "import setuptools, tokenize;file='c:\users\runa\appdata\lo 的完整输出 cal\temp\pip-build-pgrnrn\thinc\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\runa\appdata\local\temp\pip-hhhilf-record\install-record.txt --单一版本-e 外部管理--编译: 运行安装 运行构建 运行 build_py 运行 build_ext 构建“thinc.linalg”扩展 d:\Programms\Anaconda2\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -Id:\programms\anaconda2\include -Ic:\users\runa\appdata\local\temp\pip -build-pgrnrn\thinc\include -Ic:\users\runa\appdata\local\temp\pip-build-pgrnrn\thinc\include\msvc9 -Id:\programms\anaconda2\include -Id:\pr gramms\anaconda2\PC -c Thinc/linalg.cpp -o build\temp.win-amd64-2.7\Release\thinc\linalg.o -O3 -Wno-strict-prototypes -Wno-unused-function -msse3

gcc.exe:错误:thinc/linalg.cpp:没有这样的文件或目录 gcc.exe:致命错误:没有输入文件 编译终止。 错误:命令 'd:\Programms\Anaconda2\Scripts\gcc.bat' 失败,退出状态为 1 命令 "d:\programms\anaconda2\python.exe -u -c "import setuptools, tokenize;file='c:\users\runa\appdata\local\temp\pip-build-pgr nrn\thinc\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', ' \n');f.close();exec(compile(code, file, 'exec'))" 安装 --record c:\users\runa\appdata\local\temp\pip-hhhilf-record\install-record.txt --single-version-externally-managed --comp ile" 失败,错误代码 1 在 c:\users\runa\appdata\local\temp\pip-build-pgrnrn\thinc\

【问题讨论】:

    标签: c++ python-2.7


    【解决方案1】:

    问题出在这里:

    #error "Use this header only with Microsoft Visual C++ compilers!" In file included from c:\users\runa\appdata\local\temp\pip-build-...
    

    Spacy 期望在 Windows 上使用 VC++ 编译,并且错误地包含了一个自定义版本的 stdint.h,旨在解决 VC++ 的问题。

    特别是在 setup.py (https://github.com/explosion/spaCy/blob/3431e7b86feabdba014c2200692677872cd8f595/setup.py) 中,它调用 new_compiler().compiler_type == 'msvc' 来检查 Windows 上的编译器类型。然而,根据 python 文档 (https://docs.python.org/3/distutils/apiref.html),这将始终在 Windows 上返回“msvc”。

    可能最简单的解决方案是安装 Visual Studio Express 并使用 VC++ 在 Windows 上进行编译。您也可以考虑报告错误。

    【讨论】:

    • 是的,你是对的,我安装了 Visual Studio Express 2015,它开始工作了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多