正确的mt.exe语法来解决Pyodbc导入问题 [英] Correct mt.exe syntax to resolve pyodbc import problems

查看:212
本文介绍了正确的mt.exe语法来解决Pyodbc导入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次在Windows上部署Python应用程序(Apache& mod_wsgi/Flask/Sqlalchemy).

I'm deploying a Python app on Windows for the first time (Apache & mod_wsgi/Flask/Sqlalchemy).

我想使用pyodbc来使Sqlalchemy与mssql进行通信.

I'd like to use pyodbc to get Sqlalchemy talking to mssql.

我能够毫无问题地安装pyodbc的二进制版本,并且当我从命令行使用它时它可以工作.但是,mod_wsgi命中import pyodbc

I was able to install a binary build of pyodbc with no problem, and it works when I use it from the command line. However, mod_wsgi is logging import errors when it hits import pyodbc

pyodbc问题跟踪器上的该线程描述了我的问题确切地说,似乎暗示了Windows清单.但是,我不知道如何使用mt.exe来解决它.

This thread on the pyodbc issue tracker describes my issue exactly, and seems to implicate Windows manifests. However, I can't figure out how to use mt.exe to resolve it.

在PowerShell中:

In PowerShell:

C:\my\site-packages> C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\mt.exe 
-inputresource:c:\Windows\SysWOW64\python27.dll;#2 -manifest 
-outputresource:pyodbc.pyd#2'

mt.exe : command line error c10100a9: Some operation on the input manifests must
be specified (even if it is just to pipe the input to the output).
Use the /? option for help on usage and samples.`

在cmd中:

C:\my\site-packages>"C:\Program Files\Microsoft SDKs"\Windows\v7.1\Bin\mt.exe 
-inputresource:C:\Windows\SysWOW64\python27.dll#2 -outputresource:pyodbc.pyd#2

mt.exe : general error c101008c: Failed to read the manifest from the resource 
of file "C:\Windows\SysWOW64\python27.dll#2". The system cannot find the file 
specified.

我在做什么错?!

推荐答案

我是pyodbc问题跟踪器上线程的作者.

I'm the author of the thread on the pyodbc issue tracker.

除非我丢失了看起来像文件" C:\ Windows \ SysWOW64 \ python27.dll "的东西,否则该文件不存在.也许您有2.7以外的版本?

Unless I'm missing something it looks like the file "C:\Windows\SysWOW64\python27.dll" doesn't exist. Maybe you have a version other than 2.7?

否则,请确保已安装了适用于python的官方Windows程序包,并确认该版本的pyodbc导入成功.如果是这样,您应该能够从python安装根目录或其他位置替换本地python.dll(例如python27.dll)的路径.

Otherwise, make sure you have installed the official windows packages for python and verify that importing pyodbc succeeds with that version. If it does, you should be able to substitute the path to your local python.dll (e.g. python27.dll) from the python installation root or elsewhere.

这篇关于正确的mt.exe语法来解决Pyodbc导入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆