在 Windows 上使用 Python 3.4 64 位构建 VRPN 服务器

Building VRPN server with Python 3.4 64-bit on Windows

我正在尝试在 Windows 7 64 位上使用 Python 3.4 64 位构建一个带有 Python3 标志的 VRPN 服务器,但似乎有问题。我需要这个用于 BlenderVR 软件。

这是我的程序:

cmake -G"MinGW Makefiles"
-HD:\My\BlenderVR\plugins\vrpn
-BD:\My\BlenderVR\plugins\cmake
-DVRPN_BUILD_PYTHON=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_2X=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_3X=ON

我以前也添加了这些标志,但似乎没有它们也能找到 Python

-DPYTHON_INCLUDE_DIR=D:\My\BlenderVR\Required\Python3\include
-DPYTHON_LIBRARY=D:\My\BlenderVR\Required\Python3\libs\python34.lib

Python 已正确找到并且此操作不会引发任何错误。

[ 90%] Linking CXX shared module vrpn.pyd
D:/My/BlenderVR/Required/Python3/libs/python34.lib: error adding symbols: File f ormat not recognized
collect2.exe: error: ld returned 1 exit status
python\CMakeFiles\vrpn-python.dir\build.make:505: recipe for target 'python/vrpn .pyd' failed mingw32-make[2]: * * * [python/vrpn.pyd] Error 1
CMakeFiles\Makefile2:3247: recipe for target 'python/CMakeFiles/vrpn-python.dir/ all' failed mingw32-make[1]: * * * [python/CMakeFiles/vrpn-python.dir/all]
Error 2 Makefile:159: recipe for target 'all' failed
mingw32-make: [all] Error 2

vprn.pyd是我以后工作的关键

我发现它需要 libpython34.a 文件(可能)。当我创建它并将其复制到 Python3/libs 文件夹时,它可以正常工作并完成且没有错误,但是装箱的 vprn.pyd 没有正常工作。

我需要的是 import vrpn 在 python 中使用这个简单的测试(附加路径 vrpn.pyd 构建):

import sys
sys.path.append('D:/My/BlenderVR/plugins/cmake/python')
import vrpn

它让我的整个计算机滞后了一段时间,然后弹出 Python 已停止工作。

我怀疑问题出在我创建的 libpython34.a 文件中:

gendef python34.dll (in Windows/System32)
dlltool -D python34.dll -d python34.def -l libpython34.a

我不知道我应该如何获取 libpython 文件。我尝试过带有许多 CMake 标志的各种版本的 CMake 和 MinGW(如 MinGWPy、TDM、w64)。我能够使用 32 位 Python 使它工作,但我需要 64 位版本,否则它不能与 BlenderVR 环境一起工作。

我知道这是一个非常具体的问题,一开始可能有点令人困惑,但我不知道还能怎么说。我会很高兴能提供任何帮助。谢谢。

mingwpy需要用pip安装(直到PYPI正式发布):

pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy

所有必要的导入文件自动复制到 python\libs 文件夹中。 如果 python\Scripts 在 PATH 中,它应该开箱即用。

您必须确保 Blender Python 配备了两个导入文件

D:\My\BlenderVR\Required\Python3\libs\libpython\libpython34.dll.a
D:\My\BlenderVR\Required\Python3\libs\libpython\libmsvcr100.a