我是Python的新手,如果这是一个愚蠢的问题,敬请原谅。无论如何,尝试运行在PyCharm(Python IDE)上安装的软件包时遇到此错误:

Traceback (most recent call last):
  File "C:\Users\turtl\PycharmProjects\untitled\venv\Scripts\openbte-script.py", line 11, in <module>
    load_entry_point('openbte==0.9.24', 'console_scripts', 'openbte')()
  File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\__main__.py", line 47, in main
    Geometry(**vars(args))
  File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 83, in __init__
    data = self.compute_mesh_data()
  File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 91, in compute_mesh_data
    self.import_mesh()
  File "C:\Users\turtl\PycharmProjects\untitled\venv\lib\site-packages\openbte\geometry.py", line 448, in import_mesh
    a=subprocess.check_output(['gmsh','-' + str(self.dim),'mesh.geo','-o','mesh.msh'])
  File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\turtl\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified


从以前的问题中收集到的信息来看,这似乎是因为我的virtualenv中没有gmsh。既然我已经下载了gmsh,就找不到如何将其导入virtualenv的正确安装指南。有人对此有经验吗?

我想更具体地讲,有没有一种方法可以查明它试图访问的路径并将gmsh粘贴到该目录中?

最佳答案

openbte\geometry.py似乎在没有任何路径的情况下运行gmsh.exe

a=subprocess.check_output(['gmsh','-' + str(self.dim),'mesh.geo','-o','mesh.msh'])


这意味着它期望gmsh.exe%PATH%中的某个位置。因此,安装gmsh并将带有gmsh.exe的目录添加到%PATH%

08-04 09:07