FileNotFoundError: [WinError 2]

落爺英雄遲暮 提交于 2019-12-13 03:58:06

问题


I am trying to execute the following code from https://pypi.org/project/pygmsh/

import pygmsh
import numpy as np
geom = pygmsh.built_in.Geometry()
# Draw a cross.
poly = geom.add_polygon([
 [ 0.0,  0.5, 0.0],
 [-0.1,  0.1, 0.0],
 [-0.5,  0.0, 0.0],
 [-0.1, -0.1, 0.0],
 [ 0.0, -0.5, 0.0],
 [ 0.1, -0.1, 0.0],
 [ 0.5,  0.0, 0.0],
 [ 0.1,  0.1, 0.0]
 ],
 lcar=0.05
 )
axis = [0, 0, 1]
geom.extrude(
 poly,
 translation_axis=axis,
 rotation_axis=axis,
 point_on_axis=[0, 0, 0],
 angle=2.0 / 6.0 * np.pi
 )
points, cells, point_data, cell_data, field_data =pygmsh.generate_mesh(geom)

I'm getting the following error:

Traceback (most recent call last): File "C:/Users/200498/PycharmProjects/untitled/venv/test_builtin.py", line 30, in points, cells, point_data, cell_data, field_data =pygmsh.generate_mesh(geom) File "C:\ProgramData\Anaconda3\lib\site-packages\pygmsh\helpers.py", line 117, in generate_mesh gmsh_major_version = get_gmsh_major_version(gmsh_executable) File "C:\ProgramData\Anaconda3\lib\site-packages\pygmsh\helpers.py", line 81, in get_gmsh_major_version stderr=subprocess.STDOUT File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 336, in check_output **kwargs).stdout File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process: File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 709, in init restore_signals, start_new_session) File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified: especificado

How can I fix that?


回答1:


Probably you're using Windows, and "gmsh_path" variable in helpers.py in set to None, and "_get_gmsh_exe()" method in helpers.py is only setted to typical MacOS path to gmsh.exe. You must set your actual gmsh.exe path.



来源:https://stackoverflow.com/questions/50205782/filenotfounderror-winerror-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!