從http://cython.org下載安裝包,解壓到一目錄,進入該目錄,在cmd命令行中執行
python setup.py install
或使用 pip install cython命令安裝
安裝 Microsoft Visual C++ Compiler for Python 2.7:
下載:https://www.microsoft.com/en-us/download/details.aspx?id=44266
VC詳細介紹見:
https://www.cnblogs.com/yyds/p/7065637.html
VC安裝之前報錯:
python setup.py build_ext --inplace
running build_ext
building 'helloworld' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Tools\common\python\python272\include -IC:\Tools\common\python\python272\PC /Tchelloworld.c /Fobuild\temp.win-amd64-2.7\Release\helloworld.obj
helloworld.c
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Tools\common\python\python272\libs /LIBPATH:C:\Tools\common\python\python272\PCbuild\amd64 /EXPORT:inithelloworld build\temp.win-amd64-2.7\Release\helloworld.obj /OUT:build\lib.win-amd64-2.7\helloworld.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\helloworld.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\helloworld.pyd.manifest
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\link.exe"' failed with exit status 1104
安裝VC之後:
python setup.py build_ext --inplace
running build_ext
copying build\lib.win-amd64-2.7\helloworld.pyd ->
教程:
https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html#the-basics-of-cython