0
我最近從版本3.5的Winpython升級到使用python 3.6的相應版本。因此,我必須使用新的解釋器重新編譯我的C擴展。我的安裝腳本如下所示:Distutils在使用WinPython 3.6時不會調用「link.exe」,但是WinPython 3.5能夠正常工作
from distutils.core import setup, Extension
import numpy.distutils.misc_util
c_ext = Extension("heapoperations", ["heapoperations.c"])
setup(
ext_modules=[c_ext],
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs(),
)
控制檯輸出使用Python 3.5的
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'heapoperations' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\lib\site-packages\numpy\core\include" -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\include" -I"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcheapoperations.c /Fobuild\temp.win-amd64-3.5\Release\heapoperations.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\libs" /LIBPATH:"C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\PCbuild\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64" /EXPORT:PyInit_heapoperations build\temp.win-amd64-3.5\Release\heapoperations.obj /OUT:D:\MyProject\heapoperations.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\heapoperations.cp35-win_amd64.lib
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe
然而,當,當我運行與Python 3.6相同的腳本,我得到
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'heapoperations' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\lib\site-packages\numpy\core\include" -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\include" -I"C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcheapoperations.c /Fobuild\temp.win-amd64-3.6\Release\heapoperations.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
那是,link.exe
不叫。結果是我沒有得到允許我使用代碼的.pyd
文件。
什麼能解釋行爲?我怎樣才能使一切工作在WinPython 3.6下?
我在Windows 10 64位下使用64位WinPython。
可能不是答案,而是重新嘗試將python.exe旁邊的文件重命名爲python._pth,如python_nomore._pth – stonebig
@stonebig我已經完成了。它對這個問題沒有影響。我知道你對我以前的問題的答案http://stackoverflow.com/questions/42263962/modulenotfounderror-python-3-6-does-not-find-modules-while-python-3-5-does/42266369? noredirect = 1#comment71720852_42266369 – Samufi
好吧,另一個愚蠢的想法是,以前用python-3.5對象編譯過的邊界效應......也許試着改變你的文件的名字,以確保系統中沒有「先前」對象? – stonebig