我在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
答案 0 :(得分:0)
您首先需要安装POV-Ray。有关Windows二进制文件,请参见here。 然后,您需要使用POV-RAY安装的实际二进制路径更改config.py中的POVRAY_BINARY变量。
获取POV-RAY可执行文件的路径。
转到C:\ Users \ user_name \ AppData \ Local \ Programs \ Python \ Python37-32 \ Lib \ site- 包\ vapory \ config.py
替换
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