在Ubuntu 16上安装PySCIPOpt

时间:2018-03-13 01:27:00

标签: python python-3.x ubuntu-16.04 scip

我想在Ubuntu上使用Python3上的SCIP。几乎无能为力。我找不到一步一步的指南。我尝试安装接口“PySCIPOpt”让我知道了这个:

sudo python3 setup.py install
Installing collected packages: PySCIPOpt
Running setup.py install for PySCIPOpt ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tl0gl49o/PySCIPOpt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-be931oqd-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/__init__.py -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/Multidict.py -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/scip.pyx -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/scip.pxd -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/conshdlr.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/propagator.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/heuristic.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/expr.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/presol.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/sepa.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/branchrule.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/lp.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/pricer.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    copying src/pyscipopt/event.pxi -> build/lib.linux-x86_64-3.5/pyscipopt
    running build_ext
    building 'pyscipopt.scip' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/src
    creating build/temp.linux-x86_64-3.5/src/pyscipopt
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-build-tl0gl49o/PySCIPOpt/include -I/usr/include/python3.5m -c src/pyscipopt/scip.c -o build/temp.linux-x86_64-3.5/src/pyscipopt/scip.o
    src/pyscipopt/scip.c:548:23: fatal error: scip/scip.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tl0gl49o/PySCIPOpt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-be931oqd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-tl0gl49o/PySCIPOpt/

以下是我经历的步骤:

  1. 下载 http://scip.zib.de/download.php?fname=scipoptsuite-5.0.1.tgz
  2. 将其解压缩到 /home/crystal/software/SCIPSuide/SCIPOptSuite-5.0.1-Linux
  3. 导出 SCIPOPTDIR = /家庭/结晶/软件/ SCIPSuide / SCIPOptSuite-5.0.1 Linux的
  4. 从git
  5. 下载PySCIPOpt-master 提取的文件夹PySCIPOpt-master中的
  6. sudo python3 setup.py install

1 个答案:

答案 0 :(得分:0)

为什么要从源代码编译所有内容?只需下载并运行Debian/Ubuntu installer for the SCIP Optimization Suite即可。然后运行pip install pyscipopt

所有人都解释了here

我强烈建议在virtual environment内使用Python,而不是使用sudo安装Python模块。您可能还想查看Anaconda来组织Python环境。