使用特定编译器进行pip安装

问题描述 投票:0回答:1

当我在集群中执行

pip install
时(我的集群设计为使用intel编译器icpc),我收到以下错误:

$ pip install cvxopt --user
Collecting cvxopt
  Using cached cvxopt-1.1.8.tar.gz
Building wheels for collected packages: cvxopt
  Running setup.py bdist_wheel for cvxopt ... error
  Complete output from command /share/apps/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sxngrO/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpTcH01Zpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/coneprog.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/printing.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/msk.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/misc.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/__init__.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/cvxprog.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/info.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/modeling.py -> build/lib.linux-x86_64-2.7/cvxopt
  copying src/python/solvers.py -> build/lib.linux-x86_64-2.7/cvxopt
  running build_ext
  building 'base' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  creating build/temp.linux-x86_64-2.7/src/C
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/share/apps/include/python2.7 -c src/C/base.c -o build/temp.linux-x86_64-2.7/src/C/base.o
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/share/apps/include/python2.7 -c src/C/dense.c -o build/temp.linux-x86_64-2.7/src/C/dense.o
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/share/apps/include/python2.7 -c src/C/sparse.c -o build/temp.linux-x86_64-2.7/src/C/sparse.o
  gcc -pthread -shared build/temp.linux-x86_64-2.7/src/C/base.o build/temp.linux-x86_64-2.7/src/C/dense.o build/temp.linux-x86_64-2.7/src/C/sparse.o -L/usr/lib -lm -llapack -lblas -o build/lib.linux-x86_64-2.7/cvxopt/base.so
  /usr/bin/ld: cannot find -llapack
  collect2: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1

我认为可能有两个问题:

  1. 它使用

    gcc
    而不是
    icpc
    ,这是我们集群设置的目的...所以问题是是否可以为我的所有安装指定 icpc?

  2. /usr/bin/ld: cannot find -llapack: lapack library is not found
    ...Lapack 库丢失...由于我不想从源代码安装,有什么方法可以使用包管理器来安装所有这些依赖项?谢谢。

python c++ installation pip python-wheel
1个回答
0
投票

您可以通过以下方式使用 pip 配置一次安装的编译器:

pip install --global-option build_ext --global-option --compiler=<compiler_name> <package_name>

只需记住将 交换为编译器的名称 (

icpc
),并将 交换为
cvxopt

请参阅此答案,了解 Windows 上的类似方法。

© www.soinside.com 2019 - 2024. All rights reserved.