3

我一直在尝试通过运行 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 的预建副本也可以工作!)

4

2 回答 2

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!

希望它有所帮助,斯塔姆

于 2016-08-20T19:37:44.820 回答
0

您可能尝试从 default 构建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包。

于 2015-11-12T13:46:09.633 回答