2014-11-03 41 views
0

我正在開發linux python應用程序,但它們太打包,無法在Windows環境中部署。如何在交叉編譯distutils包時使用mingw32?

我用來做一切從linux開發平臺。

現在,但是我需要爲win32交叉編譯python chaco庫。

我需要給作爲參數,mingw32的編譯器,以及位於〜/的.wine/drive_c/...

蟒蛇的DLL我有使用它與mingw32的一些問題。 在環境中,我已經獲得了葡萄酒驅動器中設置的python win32。

python setup.py build --compiler=mingw32 
running build 
running build_py 
running egg_info 
writing requirements to Chaco.egg-info/requires.txt 
writing Chaco.egg-info/PKG-INFO 
writing namespace_packages to Chaco.egg-info/namespace_packages.txt 
writing top-level names to Chaco.egg-info/top_level.txt 
writing dependency_links to Chaco.egg-info/dependency_links.txt 
writing manifest file 'Chaco.egg-info/SOURCES.txt' 
running build_ext 
building 'enthought.chaco.contour.contour' extension 
gcc -mno-cygwin -mdll -O -Wall -DNUMPY -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c enthought/chaco/contour/cntr.c -o build/temp.linux-x86_64-2.6/enthought/chaco/contour/cntr.o 
cc1: error: unrecognized command line option "-mno-cygwin" 
cc1: error: unrecognized command line option "-mdll" 
error: command 'gcc' failed with exit status 1 

回答

-1

我認爲你必須使用MS VC++ 2008編譯任何非平凡的C-擴展的Python 2.6和2.7,和查科(並啓用它所依賴)肯定是算不平凡。

Mingw庫不兼容工作。

我不知道有什麼辦法可以做到這一點,而不是在Windows中。

有關鏈接獲得免費的MS編譯器,看https://support.enthought.com/entries/26864394-Windows-Unable-to-find-vcvarsall-bat-cython-f2py-other-c-extensions-

+0

不,因爲我可以從cmdline編譯擴展模塊。 – sancelot 2014-11-04 10:24:09

+0

我已經深入瞭解了這一點,這意味着修改distutils設置以正確考慮到交叉mingw32編譯器。 – sancelot 2014-11-04 10:24:57

+0

當然你可以編譯它們,但是運行時可能會出現段錯誤。 – 2014-11-04 15:57:30

0
從Linux CMDLINE

,編譯命令將類似於:

i586的-mingw32msvc-GCC -mdll -O -Wall -DNUMPY -I/home/xxx/.wine/drive_c/Python26/include -I/home/xxxx/.wine/drive_c/Python26/Lib/site-packages/numpy/core/include -c enthought/chaco/contour/cntr。 c -o build/temp.linux-x86_64-2.6/enthought/chaco/contour/cntr.o