我一直在尝试通过运行python setup.py install来安装pyodbc 3.0.7但是仍然有问题。目前我已经点击“错误:命令'cl.exe'失败:没有这样的文件或目录”墙。我在网上看的时间比我想承认试图弄清楚发生了什么更长。
我正在使用64位版本的Python 3.4
我有Microsoft Visual Studio 10.0。
我已确认vcvarsall.bat位于Program Files(x86)\ Microsoft Visual Studio 10.0 \ VC中。
我正在运行64位所以我添加了amd64文件夹并将vcvars64.bat放入Program Files(x86)\ Microsoft Visual Studio 10.0 \ VC \ bin \ amd64
中我确认cl.exe位于Program Files(x86)\ Microsoft Visual Studio 10.0 \ VC \ bin
中我重新启动计算机只是为了确保不是问题所在。
但是当我尝试安装pyodbc时,我得到以下内容
C:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7>python setup.py install
running install
running bdist_egg
running egg_info
writing pyodbc.egg-info\PKG-INFO
writing top-level names to pyodbc.egg-info\top_level.txt
writing dependency_links to pyodbc.egg-info\dependency_links.txt
reading manifest file 'pyodbc.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'tests\*'
writing manifest file 'pyodbc.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\Users
creating build\temp.win-amd64-3.4\Release\Users\William
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src
cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYODBC_VERSION=3.0.7 -IC:\Python34\include -IC:\Python34\include /TpC:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.cpp /Fobuild\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.obj /Wall /wd4668 /wd4820 /wd4711 /wd4100 /wd4127 /wd4191
error: command 'cl.exe' failed: No such file or directory
从那里开始,作为最后的努力,我试图清理和构建,但遇到了同样的问题。
C:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7>py -3 setup.py clean --all build_ext --force
running clean
removing 'build\temp.win-amd64-3.4' (and everything under it)
'build\lib.win-amd64-3.4' does not exist -- can't clean it
'build\bdist.win-amd64' does not exist -- can't clean it
'build\scripts-3.4' does not exist -- can't clean it
removing 'build'
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\Users
creating build\temp.win-amd64-3.4\Release\Users\William
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7
creating build\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src
cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYODBC_VERSION=3.0.7 -IC:\Python34\include -IC:\Python34\include /TpC:\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.cpp /Fobuild\temp.win-amd64-3.4\Release\Users\William\Downloads\pyodbc-3.0.7\pyodbc-3.0.7\src\buffer.obj /Wall /wd4668 /wd4820 /wd4711 /wd4100 /wd4127 /wd4191
error: command 'cl.exe' failed: No such file or directory
我一直用pip所以这不是我熟悉的东西所以也许我做错了。任何帮助,我会永远感激,因为我认为我已经耗尽了所有资源。 (或者pyodbc 3.0.7的预构建副本也可以使用!)
答案 0 :(得分:0)
您可能尝试使用默认Command Prompt
进行构建。这不起作用。
您必须准备Command Prompt
。我使用以下命令获取具有正确设置的命令行:
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /RELEASE /x64
您可以在桌面上创建一个新的快捷方式,这样您就不必在安装新的python模块时输入它。
现在,您可以运行新的Command Prompt
并构建Python
个包。
答案 1 :(得分:0)
Python 3.4要求Visual Studio 2010编译像pyodbc这样的软件包,所以如果你安装了不同的版本,那肯定是个问题。只需重新安装Visual Studio,一切都应该正常工作! https://www.microsoft.com/en-us/download/details.aspx?id=23691 如果您仍有问题,请考虑更改为3.5或3.6,这将很快出现!
希望它有所帮助, 斯塔姆