【问题标题】:Vapory Error: FileNotFoundError: [WinError 2] The system cannot find the file specifiedVapory 错误:FileNotFoundError: [WinError 2] 系统找不到指定的文件
【发布时间】:2019-11-20 21:29:25
【问题描述】:

我在 github 上运行了汽化的示例代码,但它有错误。

  • 代码

    from vapory import *
    
    camera = Camera( 'location', [0,2,-3], 'look_at', [0,1,2] )
    light = LightSource( [2,4,-3], 'color', [1,1,1] )
    sphere = Sphere( [0,1,2], 2, Texture( Pigment( 'color', [1,0,1] )))
    
    scene = Scene( camera, objects= [light, sphere])
    scene.render("purple_sphere.png", width=400, height=300)
    
  • 错误信息

     Traceback (most recent call last):
    File "C:\scene1.py", line 60, in <module>
    scene.render("scene1_vapory.png", width=640, height=480)
    File "C:\Users\User\Anaconda3\lib\site-packages\vapory\vapory.py", line 102, in render
    quality, antialiasing, remove_temp)
    File "C:\Users\User\Anaconda3\lib\site-packages\vapory\io.py", line 106, in render_povstring
    stdout=subprocess.PIPE)
    File "C:\Users\User\Anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
    File "C:\Users\User\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    

【问题讨论】:

  • 我没有。我必须添加它吗?
  • 我添加了purple_sphere.png,但同样的错误

标签: python-3.x povray


【解决方案1】:

您首先需要安装 POV-Ray。有关 Windows 二进制文件,请参阅 here。 然后,您需要将 config.py 中的 POVRAY_BINARY 变量更改为 POV-RAY 安装的实际二进制路径。

  1. 获取POV-RAY的可执行文件路径。

  2. 转到 C:\Users\user_name\AppData\Local\Programs\Python\Python37-32\Lib\site- 包\vapory\config.py

  3. 替换 POVRAY_BINARY = ("povray.exe" if os.name=='nt' else "povray")POVRAY_BINARY = "POV-RAY binary path"

POV-RAY 路径如下:C:\Program Files\POV-Ray\v3.7\bin\pvengine.exe

【讨论】:

  • 嗯...我的“config.py”用于驱动器 D: 上 Python 路径中的蒸汽位置。我用 POV-Ray 的实际路径替换了这个字符串,但我得到了与上面一样的错误。
【解决方案2】:

对于 Windows 7,POV-Ray 二进制文件的路径应使用“/”而不是“”,如下所示:

POVRAY_BINARY = "C:/Program Files/POV-Ray/v3.7/bin/pvengine.exe"

信息: http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/

【讨论】:

    猜你喜欢
    • 2017-08-01
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    • 2018-05-21
    • 1970-01-01
    • 1970-01-01
    • 2020-01-02
    相关资源
    最近更新 更多