我试图通过调用python _cython_build.py build_ext --inplace' in the correct subfolder. I have
Visual Studio Build Tools 2017(3)version 15.9.11 and
Visual Studio Community 2017(2)在Conda中使用Cython扩展来构建HelixMC软件包here。版本15.9.11已安装。我已经在下面发布了_cython_build.py的代码,以及我使用1)git版本2.20.0.windows.1进行的git错误。
和2)使用Visual Studio命令提示符。
我真的不知道。我正在使用Windows 10系统。我可以仅使用该包的setup.py
文件进行构建,但是我想尝试使用cython
进行构建。
_cython_build.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
ext_modules = [Extension(
"_util_cython", ["_util_cython.pyx"], include_dirs=[numpy.get_include()])]
setup(
cmdclass={'build_ext': build_ext},
ext_modules=ext_modules
)
在git bash中使用python _cython_build.py build_ext --inplace
running build_ext
building '_util_cython' extension
b'\\\x00W\x00i\x00n\x00d\x00o\x00w\x00s\x00 \x00w\x00a\x00s\x00 \x00u\x00n\x00e\x00x\x00p\x00e\x00c\x00t\x00e\x00d\x00
\x00a\x00t\x00 \x00t\x00h\x00i\x00s\x00 \x00t\x00i\x00m\x00e\x00.\x00\r\x00\n\x00'
error: Error executing cmd /u /c "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcv
arsall.bat" x86_amd64 && set
在VS Command Prompt中使用python _cython_build.py build_ext --inplace
running build_ext
skipping '_util_cython.c' Cython extension (up-to-date)
building '_util_cython' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\bjwil\Anaconda3\Lib\site-packages\numpy\core\include -IC:\Users\bjwil\Anaconda3\include -IC:\Users\bjwil\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tc_util_cython.c /Fobuild\temp.win-amd64-3.7\Release\_util_cython.obj
_util_cython.c
c:\users\bjwil\anaconda3\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
_util_cython.c(2613): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_util_cython.c(2642): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2676): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2689): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2691): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2704): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2715): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(2728): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(3372): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_util_cython.c(3435): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(3446): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(3612): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(3616): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4042): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_util_cython.c(4245): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4247): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4268): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4291): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4302): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4313): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(4375): warning C4244: '=': conversion from '__pyx_t_5numpy_intp_t' to 'long', possible loss of data
_util_cython.c(20293): error C2039: 'exc_type': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20294): error C2039: 'exc_value': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20295): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20307): error C2039: 'exc_type': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20308): error C2039: 'exc_value': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20309): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20310): error C2039: 'exc_type': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20311): error C2039: 'exc_value': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20312): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20355): error C2039: 'exc_type': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20356): error C2039: 'exc_value': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20357): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20358): error C2039: 'exc_type': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20359): error C2039: 'exc_value': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
_util_cython.c(20360): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\bjwil\anaconda3\include\pystate.h(212): note: see declaration of '_ts'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2