将gmsh放入virtualenv

时间:2018-11-25 09:00:51

标签: python pycharm virtualenv

我是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粘贴到该目录中吗?

1 个答案:

答案 0 :(得分:0)

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%