我在連接我的cython項目中的atl
庫時遇到問題。 我目前已經安裝了SP1和Visual Studio 2015的Visual C++ 9.0和Visual Studio 2008.Cython:LINK:致命錯誤LNK1104:無法打開文件'atls.lib'
當我使用完整路徑鏈接庫時,我的版本使用VS2015的python 3.5成功完成。 在連接到Visual C++ 9.0的python 2.7中,找到了頭文件,但無法鏈接庫。
我知道lib已經被移動到新版本的.h
文件中,因此可能很難重現。 我使用這個setup.py
:
# Cython compile instructions
from Cython.Build import cythonize
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
print("using distutils")
from distutils.core import setup
from distutils.extension import Extension
# Use python setup.py build_ext --inplace
# to compile
vs27 = ['C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\lib',
'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include',
'C:\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\atl\\atls',
]
vs35 = ['C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\include',
'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\lib',
'C:\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\src\\atl\\atls',]
extensions = [Extension("access", ["access.pyx"], include_dirs=vs27)]
setup(
name = "access",
ext_modules = cythonize(extensions),
include_dirs = vs27,
)
當我編譯使用Python 2.7和Visual C++ 9.0,我得到:
running build_ext
building 'access' extension
C:\Users\tboquet.R2000\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\\Program -IFiles -I(x86)\\Microsoft -IVisual -IStudio -I9.0\\VC\\atlmfc\\lib "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\atl\atls" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\atl\atls" -IC:\Anaconda3\envs\anapy27\include -IC:\Anaconda3\envs\anapy27\PC /Tpaccess.cpp /Fobuild\temp.win-amd64-2.7\Release\access.obj
access.cpp
C:\Users\tboquet.R2000\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Users\tboquet.R2000\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\\Program -IFiles -I(x86)\\Microsoft -IVisual -IStudio -I9.0\\VC\\atlmfc\\lib "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\atl\atls" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib" "-IC:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\atl\atls" -IC:\Anaconda3\envs\anapy27\include -IC:\Anaconda3\envs\anapy27\PC /Tpdbaccessor.cpp /Fobuild\temp.win-amd64-2.7\Release\dbaccessor.obj
dbaccessor.cpp
C:\Users\tboquet.R2000\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
dbaccessor.cpp(111) : warning C4267: 'argument' : conversion from 'size_t' to 'UINT', possible loss of data
c:\users\tboquet.r2000\documents\visual studio 2013\projects\accessor\accessor\dbaccessor.cpp(220) : warning C4715: 'dbaccessor::connect' : not all control paths return a value
C:\Users\tboquet.R2000\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Anaconda3\envs\anapy27\libs /LIBPATH:C:\Anaconda3\envs\anapy27\PCbuild\amd64 /EXPORT:initaccess build\temp.win-amd64-2.7\Release\access.obj build\temp.win-amd64-2.7\Release\dbaccessor.obj /OUT:build\lib.win-amd64-2.7\access.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\access.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\access.pyd.manifest
LINK : fatal error LNK1104: cannot open file 'atls.lib'
error: command 'C:\\Users\\tboquet.R2000\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104
我一定要使用鏈接庫的另一種方式或者是還有什麼有關此錯誤的解決方法?