简体   繁体   English

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

[英]Building VRPN server with Python 3.4 64-bit on Windows

I'm trying to build a VRPN server with Python3 flag using Python 3.4 64-bit on Windows 7 64-bit but there seems to be a problem. 我正在尝试在Windows 7 64位上使用Python 3.4 64位构建带有Python3标志的VRPN服务器,但是似乎存在问题。 I need this for BlenderVR software. 我需要BlenderVR软件。

This is my procedure: 这是我的程序:

  • 1) I use CMake to create makefiles (I'm using 3.4.0 version but I've also tried different ones). 1)我使用CMake创建makefile(我使用的是3.4.0版本,但我也尝试过使用其他文件)。 I do it with this command (those flags should be there but the result seems to be the same without them anyway): 我使用此命令(那些标志应该在那里,但如果没有它们,结果似乎是相同的):

cmake -G"MinGW Makefiles" cmake -G“ MinGW Makefiles”
-HD:\\My\\BlenderVR\\plugins\\vrpn -HD:\\我的\\ BlenderVR \\插件\\ VRPN
-BD:\\My\\BlenderVR\\plugins\\cmake -BD:\\我的\\ BlenderVR \\插件\\ cmake的
-DVRPN_BUILD_PYTHON=OFF -DVRPN_BUILD_PYTHON = OFF
-DVRPN_BUILD_PYTHON_HANDCODED_2X=OFF -DVRPN_BUILD_PYTHON_HANDCODED_2X = OFF
-DVRPN_BUILD_PYTHON_HANDCODED_3X=ON -DVRPN_BUILD_PYTHON_HANDCODED_3X = ON

I used to add those flags as well but it seems that it can find Python without them 我也曾经添加过这些标志,但是似乎没有它们也可以找到Python

-DPYTHON_INCLUDE_DIR=D:\\My\\BlenderVR\\Required\\Python3\\include -DPYTHON_INCLUDE_DIR = d:\\我的\\ BlenderVR \\必需\\ Python3 \\包括
-DPYTHON_LIBRARY=D:\\My\\BlenderVR\\Required\\Python3\\libs\\python34.lib -DPYTHON_LIBRARY = d:\\我的\\ BlenderVR \\必需\\ Python3 \\库\\ python34.lib

Python is correctly found and this operation doesn't throw any error. 正确找到了Python,并且此操作不会引发任何错误。

  • 2) Then I use mingw32-make.exe to build it and I get this error: 2)然后我使用mingw32-make.exe来构建它,并且出现此错误:

[ 90%] Linking CXX shared module vrpn.pyd [90%]链接CXX共享模块vrpn.pyd
D:/My/BlenderVR/Required/Python3/libs/python34.lib: error adding symbols: File f ormat not recognized D:/My/BlenderVR/Required/Python3/libs/python34.lib:错误添加符号:无法识别文件格式
collect2.exe: error: ld returned 1 exit status collect2.exe:错误:ld返回1退出状态
python\\CMakeFiles\\vrpn-python.dir\\build.make:505: recipe for target 'python/vrpn .pyd' failed mingw32-make[2]: * * * [python/vrpn.pyd] Error 1 python \\ CMakeFiles \\ vrpn-python.dir \\ build.make:505:目标'python / vrpn .pyd'的配方失败mingw32-make [2]:* * * [python / vrpn.pyd]错误1
CMakeFiles\\Makefile2:3247: recipe for target 'python/CMakeFiles/vrpn-python.dir/ all' failed mingw32-make[1]: * * * [python/CMakeFiles/vrpn-python.dir/all] CMakeFiles \\ Makefile2:3247:目标'python / CMakeFiles / vrpn-python.dir / all'的配方失败mingw32-make [1]:* * * [python / CMakeFiles / vrpn-python.dir / all]
Error 2 Makefile:159: recipe for target 'all' failed 错误2 Makefile:159:目标“全部”的配方失败
mingw32-make: [all] Error 2 mingw32-make:[全部]错误2

vprn.pyd is the crucial thing for my future work. vprn.pyd是我未来工作的关键。

I figured out that it needs libpython34.a file (probably). 我发现它需要libpython34.a文件(可能)。 When I created it and copied to Python3/libs folder it worked and finished without errors but the crated vprn.pyd didn't worked as it should. 当我创建它并将其复制到Python3 / libs文件夹时,它可以正常工作并且没有出现错误,但是创建的vprn.pyd并没有正常工作。

What I need is to get import vrpn to work with this simple test in python (appending path where vrpn.pyd was build): 我需要的是使导入vrpn可以在python中进行此简单测试(附加了构建vrpn.pyd的路径):

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

It lags my whole computer for a while and then pops out that Python has stop working. 它使我的整个计算机滞后了一段时间,然后弹出Python停止工作的提示。

I suspect that problem is in the libpython34.a file that I created doing this: 我怀疑问题出在我为此创建的libpython34.a文件中:

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

I don't how else should I get the libpython file. 我不知道应该如何获取libpython文件。 I've tried various versions of CMake and MinGW (like MinGWPy, TDM, w64) with many CMake flags. 我尝试了带有许多CMake标志的各种版本的CMake和MinGW(如MinGWPy,TDM,w64)。 I was able to make it work using 32-bit Python but I need 64-bit version otherwise it is not working with BlenderVR enviroment. 我能够使用32位Python使其工作,但我需要64位版本,否则它不适用于BlenderVR环境。

I know this is very specific problem and probably kind of confusing at first but I didn't know how else to put it. 我知道这是一个非常具体的问题,一开始可能会造成混淆,但我不知道该怎么办。 I'll be glad for anything that could help. 我很高兴有什么可以帮助的。 Thank you. 谢谢。

mingwpy should be installed with pip (until it is officially released at PYPI): mingwpy应该与pip一起安装(直到PYPI正式发布为止):

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

all necessary import files are atomatically copied into the python\\libs folder. 所有必需的导入文件都被原子复制到python \\ libs文件夹中。 If python\\Scripts is in the PATH it should work out of the box. 如果python \\ Scripts在PATH中,则应立即使用。

You have to make sure, that Blender Python is equiped with two import files 您必须确保Blender Python配备了两个导入文件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM