PKG_CONFIG_PATH环境变量(安装ipopt错误)

时间:2020-06-13 09:53:24

标签: macos python-3.7 pkg-config ipopt

我尝试安装ipoptpip install ipopt

这是我的错误:

    Collecting ipopt
  Using cached ipopt-0.2.0.tar.gz (162 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-install-i9o4pqdg/ipopt/setup.py'"'"'; __file__='"'"'/private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-install-i9o4pqdg/ipopt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-pip-egg-info-_gej3ysb
         cwd: /private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-install-i9o4pqdg/ipopt/
    Complete output (11 lines):
    Package ipopt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ipopt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ipopt' found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-install-i9o4pqdg/ipopt/setup.py", line 102, in <module>
        **pkgconfig('ipopt'))]
      File "/private/var/folders/3w/zf3x85h55tv7qk2yg8ykztwc0000gn/T/pip-install-i9o4pqdg/ipopt/setup.py", line 58, in pkgconfig
        raise OSError(msg.format(list(packages)))
    OSError: pkg-config was not able to find any of the requested packages ['ipopt'] on your system. Make sure pkg-config can discover the .pc files associated with the installed packages.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

命令pkg-config --variable pc_path pkg-config给出:

/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.15

做到了这一点(但我认为链接很奇怪),但没有解决问题

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.15

1 个答案:

答案 0 :(得分:0)

您必须执行以下命令:

sudo apt-get install gcc g ++ gfortran git patch wget pkg-config liblapack-dev libmetis-dev