如何使用 Visual Basic 2005 中的 python 2.6?
从 Visual Basic 2005 调用 python 脚本的最佳方法是什么?
我有一个用 Visual Basic 2005 编写的应用程序,需要调用用 Python 编写的库。该库需要 python 2.6。我正在使用 python C API 从 Visual Basic 代码访问 python 库(私有声明函数 blah lib“python26.dll”等)。我这样做是因为我想在 python 库完成它的工作后从 python 中提取值。不幸的是,我收到有关 C 运行时的错误:
“R6034:应用程序尝试错误地加载 C 运行时库。”
我认为这是 MSVCR80.dll(2005 运行时)和 MSVCR90.dll(python 26 使用的 2008 运行时)之间的冲突。使用 Visual C++ 2005 编写的简单存根程序与 Visual Basic 代码执行的操作基本相同,也会引发该错误。如果我用 Visual C++ 2008 编译它运行良好。
那么我该怎么办呢?我无法离开 VB,甚至无法转向 2008 版本。我已经使用 MSVC 2005 重新编译了 python 2.6,但这还不够。我是否必须找到该库使用的所有 python 包并重新编译它们?看来一定有更简单的方法。
What's the best way to call python scripts from Visual Basic 2005?
I've got an application written in visual basic 2005 that needs to call into a library written in python. The library requires python 2.6. I'm using the python C API to access the python library from the visual basic code (private declare function blah lib "python26.dll" etc). I'm doing it this way because I want to pull values out of python after the python library does its thing. Unfortunately, I get an error about the C run-time:
"R6034: An application has made an attempt to load the C runtime library incorrectly."
I think it's a conflict between MSVCR80.dll (the 2005 runtime) and MSVCR90.dll (the 2008 runtime that python 26 uses). A simple stub program written with Visual C++ 2005 that does essentially the same thing as the visual basic code also throws that error. If I compile with Visual C++ 2008 it runs fine.
So what do I do about it? I can't move away from VB, or even move to the 2008 version. I've already recompiled python 2.6 using MSVC 2005, and that wasn't enough. Do I have to track down all of the python packages the library uses and recompile those too? It seems like there must be an easier way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论