安装Pandas的问题

时间:2016-05-31 22:35:08

标签: python pandas

我无法在我的Linux服务器上安装Pandas。我正在使用virtualenv,但我尝试安装Pandas,但没有运气。

    root@host:~# uname -a
    Linux host 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Numpy会安装很多警告。

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting numpy
  Using cached numpy-1.11.0.tar.gz
    Running from numpy source directory.
Installing collected packages: numpy
  Running setup.py install for numpy
...(truncated)
    /tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1652: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      warnings.warn(BlasSrcNotFoundError.__doc__)
    /tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1542: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    /tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1553: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      warnings.warn(LapackNotFoundError.__doc__)
    /tmp/pip-build-q8d07pgn/numpy/numpy/distutils/system_info.py:1556: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      warnings.warn(LapackSrcNotFoundError.__doc__)
    /usr/local/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
Successfully installed numpy-1.11.0

Pandas安装完全失败:

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pandas
  Using cached pandas-0.18.1.tar.gz
    package init file 'pandas/io/tests/sas/__init__.py' not found (or not a regular file)
    warning: no directories found matching 'examples'
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=2 in /usr/local/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/local/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python3.4/site-packages (from python-dateutil>=2->pandas)
Installing collected packages: pandas
  Running setup.py install for pandas
...(truncated)
    `gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages/numpy/core/include -I/usr/local/include/python3.4m -c pandas/src/testing.c -o build/temp.linux-x86_64-3.4/pandas/src/testing.o -Wno-unused-function

    gcc -pthread -shared build/temp.linux-x86_64-3.4/pandas/src/testing.o -lm -o build/lib.linux-x86_64-3.4/pandas/_testing.cpython-34m.so

    skipping 'pandas/msgpack/_packer.cpp' Cython extension (up-to-date)

    building 'pandas.msgpack._packer' extension

    creating build/temp.linux-x86_64-3.4/pandas/msgpack

    gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LITTLE_ENDIAN__=1 -Ipandas/src/msgpack -Ipandas/src/klib -Ipandas/src -I/app01/html/jay/.virtualenvs/dj/lib/python3.4/site-packages/numpy/core/include -I/usr/local/include/python3.4m -c pandas/msgpack/_packer.cpp -o build/temp.linux-x86_64-3.4/pandas/msgpack/_packer.o -Wno-unused-function

    gcc: error trying to exec 'cc1plus': execvp: No such file or directory

    error: command 'gcc' failed with exit status 1

    ----------------------------------------
    Command "/app01/html/jay/.virtualenvs/dj/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-oi7a9h9i/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e5lrr_if-record/install-record.txt --single-version-externally-managed --compile --install-headers /app01/html/jay/.virtualenvs/dj/include/site/python3.4" failed with error code 1 in /tmp/pip-build-oi7a9h9i/pandas

我尝试创建交换文件只是为了消除内存问题,这没有帮助。

我可以用

安装pandas
sudo apt-get install python-pandas

但是这个安装pandas的系统默认Python 2.7。我在虚拟环境中使用python 3.4。

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

我注意到我的错误始于此:

You are using pip version 6.0.8, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting numpy
  Using cached numpy-1.11.0.tar.gz
    Running from numpy source directory.
Installing collected packages: numpy
  Running setup.py install for numpy
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
  - `pip install .`       (from a git repo or downloaded source
                           release)
  - `pip install numpy`   (last Numpy release on PyPi)

这最终解决了我的问题:

全局升级pip(旧点数版本6.0.8到新版本8.1.2):

sudo pip3 install --upgrade pip

在virtualenv中,

pip3 install numpy pip3 install pandas