代码之家  ›  专栏  ›  技术社区  ›  Tom242

无法安装或使用Py3ODE克隆的代码

  •  0
  • Tom242  · 技术社区  · 3 年前

    作为上下文,我在Windows 10机器上工作,并更新了pip(23.1.2)和python(3.11.3)

    我正在尝试运行一个有点旧的开源代码(如果有帮助的话,这个代码-> https://github.com/locuslab/lcp-physics/tree/master ).有两个要求:安装pygames和py3ode。它在pygames上运行良好,但我无法安装py3ode。

    我还试图克隆py3ode的开源代码,并在Pycharm上的本地副本中使用它,但我未能编写正确的导入,并要求我的代码理解py3ode引用。

    以下是更多详细信息

    我尝试了使用最新版本的pip和python安装py3ode,还尝试了使用pipv9.0.3和python(3.6.2)的虚拟环境,我认为这是他们当时使用的。相同错误:

    Collecting Py3ODE
      Cache entry deserialization failed, entry ignored
      Cache entry deserialization failed, entry ignored
      Downloading https://files.pythonhosted.org/packages/bf/67/afc9c84e906e8510c34cea5e21644fbeb4568505e5c7a044840ede9329a3/Py3ODE-1.2.0.dev15.tar.gz (594kB)
        100% |████████████████████████████████| 604kB 1.9MB/s
        Complete output from command python setup.py egg_info:
        'ode-config' is not recognized as an internal or external command,
        operable program or batch file.
        'ode-config' is not recognized as an internal or external command,
        operable program or batch file.
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "C:\Users\tom\AppData\Local\Temp\pip-build-_uy3tlu9\Py3ODE\setup.py", line 142, in <module>
            install_ode()
          File "C:\Users\tom\AppData\Local\Temp\pip-build-_uy3tlu9\Py3ODE\setup.py", line 125, in install_ode
            subprocess.check_call(['./install_ode.sh', install_dir])
          File "C:\Users\tom\AppData\Local\anaconda3\envs\myenvTest\lib\subprocess.py", line 286, in check_call
            retcode = call(*popenargs, **kwargs)
          File "C:\Users\tom\AppData\Local\anaconda3\envs\myenvTest\lib\subprocess.py", line 267, in call
            with Popen(*popenargs, **kwargs) as p:
          File "C:\Users\tom\AppData\Local\anaconda3\envs\myenvTest\lib\subprocess.py", line 707, in __init__
            restore_signals, start_new_session)
          File "C:\Users\tom\AppData\Local\anaconda3\envs\myenvTest\lib\subprocess.py", line 992, in _execute_child
            startupinfo)
        OSError: [WinError 193] %1 is not a valid Win32 application
        WARNING: <ode/ode.h> not found. Downloading and installing it now to your home directory.
        If it's already installed you may have to adjust INC_DIRS in setup.py.
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\tom\AppData\Local\Temp\pip-build-_uy3tlu9\Py3ODE\
    

    我还试图克隆py3ode的代码,我认为这是一个: https://github.com/filipeabperes/Py3ODE 。这是我的架构,我把Py3ODE的代码放在文件夹“ode_fold”中,我想在lcp physics>演示 enter image description here

    demo.py调用bodies.py,后者在以下几行中有一些错误

    ...
    import ode
    ...
    ode.GeomBox(...)
    

    enter image description here

    enter image description here

    我相信“导入ode”是指ode_fold>中的ode.pyx;src>ode.pyx,但我不能写import ode.pyx.当我写ode时,我只能在行上写import node_fold等。GeomBox它找不到属性GeomBox。当然,我既不能写ode_fold.src.ode.GeomBox,但这正是我想“说”的。。。

    在互联网上,我被告知要用

    import pyximport
    pyximport.install()
    from ode_fold.src import ode
    

    但是我有一个我从未使用过的Cython编译错误,所以我不知道如何修复它,我觉得我在Cython上走错了方向

    C:\Users\tom\AppData\Local\anaconda3\envs\chrono_venv4\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\tom\...\Workspace\lcp-physics\ode_fold\src\ode.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    include "geoms.pyx"
    
    # Include the generated trimesh switch file that either includes the real
    # trimesh wrapper (trimesh.pyx/trimeshdata.pyx) or a dummy wrapper
    # (trimesh_dummy.pyx) if trimesh support is not available/desired.
    include "_trimesh_switch.pyx"
    ^
    ------------------------------------------------------------
    
    C:\Users\tom\...\Workspace\lcp-physics\ode_fold\src\ode.pyx:187:0: '_trimesh_switch.pyx' not found
    ...
    ImportError: Building module ode_fold.src.ode failed: ["distutils.errors.CompileError: command 'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\\\\VC\\\\Tools\\\\MSVC\\\\14.36.32532\\\\bin\\\\HostX86\\\\x64\\\\cl.exe' failed with exit code 2\n"]
    

    有人能帮我找出如何告诉第一个代码引用我克隆的py3ode吗? 如果你有关于pip安装的想法,我也会接受它,但我认为它可能太旧了,可能不再工作了

    谢谢!

    0 回复  |  直到 3 年前