Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
构建Python(3.2)的C扩展,但出现错误;找不到-lmsvcr90“;_Python_C - Fatal编程技术网

构建Python(3.2)的C扩展,但出现错误;找不到-lmsvcr90“;

构建Python(3.2)的C扩展,但出现错误;找不到-lmsvcr90“;,python,c,Python,C,我正在尝试在Windows上使用distutils构建Python(3.2)的C扩展。 下面是代码:(来自Python(3.1.3)源代码发行版中的Demo/embed/Demo.c) 我构建的“setup.py”文件如下所示: from distutils.core import setup, Extension module1 = Extension('xyzzy', sources = ['demo.c']) setup (name = 'xyz

我正在尝试在Windows上使用distutils构建Python(3.2)的C扩展。 下面是代码:(来自Python(3.1.3)源代码发行版中的Demo/embed/Demo.c)

我构建的“setup.py”文件如下所示:

from distutils.core import setup, Extension

module1 = Extension('xyzzy',
                    sources = ['demo.c'])

setup (name = 'xyzzy',
       version = '1.0',
       description = 'This is a demo package',
       ext_modules = [module1])
然后我运行“setup.bat”:

我得到了下面的错误信息:

C:\Documents and Settings\Administrator\桌面\C扩展python>python.exe setup.py bui
ld -c mingw32
running build
running build_ext
building 'xyzzy' extension
creating build
creating build\temp.win32-3.2
creating build\temp.win32-3.2\Release
D:\Program Files\DEV-CPP\Bin\gcc.exe -mno-cygwin -mdll -O -Wall -ID:\Python32\in
clude -ID:\Python32\PC -c demo.c -o build\temp.win32-3.2\Release\demo.o
demo.c:8: warning: return type defaults to `int'
demo.c: In function `main':
demo.c:56: warning: control reaches end of non-void function
writing build\temp.win32-3.2\Release\xyzzy.def
creating build\lib.win32-3.2
D:\Program Files\DEV-CPP\Bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-3.2
\Release\demo.o build\temp.win32-3.2\Release\xyzzy.def -LD:\Python32\libs -LD:\P
ython32\PCbuild -lpython32 -lmsvcr90 -o build\lib.win32-3.2\xyzzy.pyd
D:\Program Files\DEV-CPP\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld
.exe: cannot find -lmsvcr90
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

C:\Documents and Settings\Administrator\桌面\C扩展python>pause
请按任意键继续. . .
我不明白“找不到-lmsvcr90”是什么意思??顺便说一下,我使用DEV C++的编译器(是问题吗?)
有人能帮我吗,谢谢。

msvcr90是Microsoft Visual C运行时。使用visualstudio的唯一描述;我不知道它是否能用DEV C++工作。您可以下载免费的“Visual Studio Express”。

非常感谢。我已经解决了这个问题。我下载了VS2008,在floder中找到了文件“msvcp90.dll”。然后我将“svcp90.dll”复制到D:\Python32\libs,并再次运行“python.exe setup.py build-c mingw32”,得到了正确的结果(pyd)!请发发发慈悲,学习如何正确设置问题的格式!
python.exe setup.py build -c mingw32
pause
C:\Documents and Settings\Administrator\桌面\C扩展python>python.exe setup.py bui
ld -c mingw32
running build
running build_ext
building 'xyzzy' extension
creating build
creating build\temp.win32-3.2
creating build\temp.win32-3.2\Release
D:\Program Files\DEV-CPP\Bin\gcc.exe -mno-cygwin -mdll -O -Wall -ID:\Python32\in
clude -ID:\Python32\PC -c demo.c -o build\temp.win32-3.2\Release\demo.o
demo.c:8: warning: return type defaults to `int'
demo.c: In function `main':
demo.c:56: warning: control reaches end of non-void function
writing build\temp.win32-3.2\Release\xyzzy.def
creating build\lib.win32-3.2
D:\Program Files\DEV-CPP\Bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-3.2
\Release\demo.o build\temp.win32-3.2\Release\xyzzy.def -LD:\Python32\libs -LD:\P
ython32\PCbuild -lpython32 -lmsvcr90 -o build\lib.win32-3.2\xyzzy.pyd
D:\Program Files\DEV-CPP\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld
.exe: cannot find -lmsvcr90
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

C:\Documents and Settings\Administrator\桌面\C扩展python>pause
请按任意键继续. . .