5

pip install numpy在我自己的 Mac OSX 机器上的 python virtualenv 和运行 Arch Linux 的另一台机器上完美运行。

不幸的是,相同的命令无法在同事的运行 Gentoo 的机器上运行。

这是显示错误日志的 pip.log:-

building data_files sources

build_src: building npy-pkg config files

running build_py

copying numpy/version.py -> build/lib.linux-x86_64-2.7/numpy

copying build/src.linux-x86_64-2.7/numpy/__config__.py -> build/lib.linux-x86_64-2.7/numpy

copying build/src.linux-x86_64-2.7/numpy/distutils/__config__.py -> build/lib.linux-x86_64-2.7/numpy/distutils

running build_clib

customize UnixCCompiler

customize UnixCCompiler using build_clib

running build_ext

customize UnixCCompiler

customize UnixCCompiler using build_ext

customize GnuFCompiler

customize IntelFCompiler

customize LaheyFCompiler

customize PGroupFCompiler

customize AbsoftFCompiler

customize NAGFCompiler

customize VastFCompiler

customize CompaqFCompiler

customize IntelItaniumFCompiler

customize IntelEM64TFCompiler

customize Gnu95FCompiler

customize Gnu95FCompiler

customize Gnu95FCompiler using build_ext

building 'numpy.linalg.lapack_lite' extension

compiling C sources

C compiler: x86_64-pc-linux-gnu-gcc -pthread -O3 -march=native -pipe -fomit-frame-pointer -fno-ident -fPIC



compile options: '-DNO_ATLAS_INFO=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'

x86_64-pc-linux-gnu-gcc: numpy/linalg/lapack_litemodule.c

x86_64-pc-linux-gnu-gcc: numpy/linalg/python_xerbla.c

/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so

/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'

collect2: ld returned 1 exit status

/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'

collect2: ld returned 1 exit status

error: Command "/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1

----------------------------------------

Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy

Exception information:
Traceback (most recent call last):
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
    requirement.install(install_options, global_options)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy

看来我同事机器上的 gfortran 与他试图在 virtualenv 中安装的 numpy 包不能很好地配合。知道为什么会这样吗?

4

2 回答 2

7

如果设置了CFLAGSCXXFLAGSLDFLAGS,则可能会导致此问题。问题是那些环境变量会覆盖编译脚本中的设置,从而导致问题。

只需取消设置它们以调用 pip 命令,您就应该一切就绪。

于 2012-08-03T15:19:22.317 回答
0

在我看来,setuptools 无法正常工作,setuptools 已被 python“dist”实用程序取代,因此您可能需要安装它并重试安装。

于 2012-08-02T03:49:38.560 回答