02 windows python 2.7 安装和使用 cython

安装Cython:

pip install Cython --install-option="--no-cython-compile"

或从http://cython.org下载安装包,解压到一目录,进入该目录,在cmd命令行中执行

安装VC:

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

https://blog.csdn.net/secretx/article/details/17472107

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 ->

Cython学习教程:

https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html#the-basics-of-cython

猜你喜欢

转载自blog.csdn.net/wanzew/article/details/106168257
今日推荐