如何修复搜索路径上的amplpy错误?

2024-09-30 02:22:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我最近安装了适用于python 3.6.5(win 32位)的Amplpy,但我面临以下问题:

  • 请确保AMPL文件夹位于系统搜索路径中,或通过以下方式指定路径:
    AMPL(环境('AMPL安装目录的完整路径'))

RuntimeError                              Traceback (most recent call last)
<ipython-input-4-1768ae85d3ec> in <module>()
      1 from amplpy import AMPL
----> 2 ampl = AMPL()

D:\Poulad\Program\myprog\lib\site-packages\amplpy\ampl.py in __init__(self, environment, langext)
     83         if environment is None:
     84             try:
---> 85                 self._impl = amplpython.AMPL()
     86             except RuntimeError as e:
     87                 from sys import stderr

RuntimeError: AMPL could not be started: The system cannot find the file specified.

我还通过sys.path.append()将amplpy和amplpython路径添加到搜索路径中,但错误再次弹出

你能帮我解决这个问题吗


Tags: infromimportself路径文件夹environmentsys

热门问题