簡體   English   中英

無法在生產服務器上安裝SciPy

[英]Can't install SciPy on production server

我正在嘗試在雲中的Ubuntu計算機上安裝SciPy。 這是我遵循的步驟:

  • sudo pip安裝numpy
  • sudo apt-get安裝gfortran
  • 須藤apt-get install libblas-dev
  • 須藤apt-get install liblapack-dev
  • 須藤apt-get install g ++
  • sudo pip安裝scipy

供您參考,它是Ubuntu 14.04,Python 2.7.6。 我沒有安裝Python,就像pip和easy_install一樣,它已經在計算機中。 這是pip.log:

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

collect2: error: ld returned 1 exit status

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

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

collect2: error: ld returned 1 exit status

error: Command "/usr/bin/gfortran -Wall -g -L/opt/bitnami/common/lib -L/opt/bitnami/common/lib build/temp.linux-x86_64-2.7/numpy/core/blasdot/_dotblas.o -L/usr/lib
-L/opt/bitnami/python/lib -Lbuild/temp.linux-x86_64-2.7 -lopenblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/core/_dotblas.so" failed with exit status 1

----------------------------------------  
Cleaning up...   Removing temporary dir /tmp/pip_build_root... Command /opt/bitnami/python/bin/.python2.7.bin -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Lm8nxq-record/install-record.txt
    --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/numpy Exception information: 

Traceback (most recent call last):
File "/opt/bitnami/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 130, in main
    status = self.run(options, args)   File "/opt/bitnami/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)   File "/opt/bitnami/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)   File "/opt/bitnami/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)   File "/opt/bitnami/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd)) InstallationError: Command /opt/bitnami/python/bin/.python2.7.bin -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Lm8nxq-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/numpy

點文件:

#!/opt/bitnami/python/bin/.python2.7.bin
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
__requires__ = 'pip==1.5.6' import sys from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
    )

easy_install文件:

#!/usr/bin/env /opt/bitnami/python/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'distribute==0.6.34','console_scripts','easy_install'
__requires__ = 'distribute==0.6.34' import sys from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('distribute==0.6.34', 'console_scripts', 'easy_install')()
    )

請幫忙。

這是由gfortran編譯器標志引起的嗎? 只是懷疑。

Ubuntu軟件包

SciPy手冊建議使用Ubuntu版本而不是pip版本

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

點子

另一種方法是安裝先決條件

sudo apt-get install python-pip python-dev build-essential
sudo pip install numpy
sudo apt-get install libatlas-base-dev gfortran
sudo pip install scipy

我剛剛在一台AWS Ubuntu 14.04機器上對其進行了測試,經過漫長的編譯過程並發出大量警告,一切似乎都可以正常工作。

我通常建議使用后者,因為它可以在任何virtualenv上運行,而前者則在系統范圍內安裝軟件包。

我可以通過更改以下環境變量在bitnami上安裝numpy / scipy:

export LDFLAGS="-shared"

然后,安裝到scipy的步驟是:

sudo apt-get update -y
sudo apt-get install python-pip python-dev build-essential
sudo pip install numpy
sudo apt-get install libatlas-base-dev gfortran
sudo pip install scipy

參考numpy問題

這個問題仍然存在,因此我刪除了/opt/bitnami/python上的自定義安裝並開始使用系統安裝,現在一切正常

我使用安裝了scipy和numpy

sudo apt-get install python-numpy python-scipy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM