【问题标题】:how to install panda using easy_install?如何使用 easy_install 安装熊猫?
【发布时间】:2015-06-14 18:59:30
【问题描述】:

我在 Windows 8 中使用 python 2.7.8,在 cmd 上我写了 easy_install pandas。经过一些处理后,它给了我一个错误并要求我下载 vcpython27。

在 cmd 上:

C:\Python27\Scripts>easy_install.exe pandas
Searching for pandas
Best match: pandas 0.16.2
Processing pandas-0.16.2-py2.7-win32.egg
pandas 0.16.2 is already the active version in easy-install.pth

Using c:\python27\lib\site-packages\pandas-0.16.2-py2.7-win32.egg
Processing dependencies for pandas
Searching for numpy>=1.7.0
Reading https://pypi.python.org/simple/numpy/
Best match: numpy 1.9.2
Downloading https://pypi.python.org/packages/source/n/numpy/numpy-1.9.2.zip#md5=
e80c19d2fb25af576460bb7dac31c59a
Processing numpy-1.9.2.zip
Writing c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\setup.c
fg
Running numpy-1.9.2\setup.py -q bdist_egg --dist-dir c:\users\dell\appdata\local
\temp\easy_install-ifrvr4\numpy-1.9.2\egg-dist-tmp-1tqap5
Running from numpy source directory.
non-existing path in 'numpy\\distutils': 'site.cfg'
non-existing path in 'numpy\\f2py': 'docs'
non-existing path in 'numpy\\f2py': 'f2py.1'
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1603: 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__)
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1612: UserWarning:
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  warnings.warn(BlasNotFoundError.__doc__)
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1615: 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__)
non-existing path in 'numpy\\lib': 'benchmarks'
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1505: 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__)
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1516: 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__)
c:\users\dell\appdata\local\temp\easy_install-ifrvr4\numpy-1.9.2\numpy\distutils
\system_info.py:1519: 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__)
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
 'define_macros'
  warnings.warn(msg)
**error: Setup script exited with error: Microsoft Visual C++ 9.0 is required (Una
ble to find vcvarsall.bat). Get it from http://aka.ms/vcpython27**

但是在我安装“vcpython27”之后它给了我:

在 cmd 上:

n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _atanhl referenced i
n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _hypotl referenced i
n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _atan2l referenced i
n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _powl referenced in
function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _fmodl referenced in
 function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _modfl referenced in
 function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _frexpl referenced i
n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _ldexpl referenced i
n function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _exp2l referenced in
 function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _log2l referenced in
 function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _copysignl reference
d in function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.obj : error LNK2019: unresolved external symbol _nextafterl referenc
ed in function _main
_configtest.exe : fatal error LNK1120: 1 unresolved externals
_configtest.c
_configtest.c(8) : error C2065: 'HAVE_DECL_SIGNBIT' : undeclared identifier
_configtest.c
_configtest.c(8) : error C2065: 'HAVE_DECL_ISFINITE' : undeclared identifier
_configtest.c
_configtest.c(8) : error C2065: 'signbit' : undeclared identifier
_configtest.c
_configtest.c(8) : error C2065: 'isfinite' : undeclared identifier
_configtest.c
_configtest.c(1) : fatal error C1083: Cannot open include file: 'complex.h': No
such file or directory
BUILD_ARCHITECTURE: 'Intel', os.name='nt', sys.platform='win32'
_configtest.c
_configtest.c(3) : error C2054: expected '(' to follow 'inline'
_configtest.c(4) : error C2085: 'static_func' : not in formal parameter list
_configtest.c(4) : error C2143: syntax error : missing ';' before '{'
_configtest.c(7) : error C2054: expected '(' to follow 'inline'
_configtest.c(8) : error C2085: 'nostatic_func' : not in formal parameter list
_configtest.c(8) : error C2143: syntax error : missing ';' before '{'
_configtest.c
_configtest.c(3) : error C2054: expected '(' to follow '__inline__'
_configtest.c(4) : error C2085: 'static_func' : not in formal parameter list
_configtest.c(4) : error C2143: syntax error : missing ';' before '{'
_configtest.c(7) : error C2054: expected '(' to follow '__inline__'
_configtest.c(8) : error C2085: 'nostatic_func' : not in formal parameter list
_configtest.c(8) : error C2143: syntax error : missing ';' before '{'
_configtest.c
_configtest.c(7) : error C2065: 'Py_UNICODE_WIDE' : undeclared identifier
File: build\src.win32-2.7\numpy\core\include/numpy\config.h
#define SIZEOF_PY_INTPTR_T 4
#define SIZEOF_OFF_T 4
#define SIZEOF_PY_LONG_LONG 8
#define MATHLIB
#define HAVE_SIN 1
#define HAVE_COS 1
#define HAVE_TAN 1
#define HAVE_SINH 1
#define HAVE_COSH 1
#define HAVE_TANH 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_CEIL 1
#define HAVE_SQRT 1
#define HAVE_LOG10 1
#define HAVE_LOG 1
#define HAVE_EXP 1
#define HAVE_ASIN 1
#define HAVE_ACOS 1
#define HAVE_ATAN 1
#define HAVE_FMOD 1
#define HAVE_MODF 1
#define HAVE_FREXP 1
#define HAVE_LDEXP 1
#define HAVE_ATAN2 1
#define HAVE_POW 1
#define HAVE_XMMINTRIN_H 1
#define HAVE_EMMINTRIN_H 1
#define HAVE__MM_LOAD_PS 1
#define HAVE__MM_LOAD_PD 1
#define HAVE___DECLSPEC_THREAD_ 1
#define __NPY_PRIVATE_NO_SIGNAL
#define FORCE_NO_LONG_DOUBLE_FORMATTING
#define ENABLE_SEPARATE_COMPILATION 1
#define HAVE_LDOUBLE_IEEE_DOUBLE_LE 1
#ifndef __cplusplus
#define inline __inline
#endif

#ifndef _NPY_NPY_CONFIG_H_
#error config.h should never be included directly, include npy_config.h instead
#endif

EOF
_configtest.c
_configtest.c(1) : fatal error C1083: Cannot open include file: 'inttypes.h': No
 such file or directory
_configtest.c
_configtest.c(6) : fatal error C1189: #error :  gcc >= 4 required
File: build\src.win32-2.7\numpy\core\include/numpy\_numpyconfig.h
#define NPY_SIZEOF_SHORT SIZEOF_SHORT
#define NPY_SIZEOF_INT SIZEOF_INT
#define NPY_SIZEOF_LONG SIZEOF_LONG
#define NPY_SIZEOF_FLOAT 4
#define NPY_SIZEOF_COMPLEX_FLOAT 8
#define NPY_SIZEOF_DOUBLE 8
#define NPY_SIZEOF_COMPLEX_DOUBLE 16
#define NPY_SIZEOF_LONGDOUBLE 8
#define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16
#define NPY_SIZEOF_PY_INTPTR_T 4
#define NPY_SIZEOF_OFF_T 4
#define NPY_SIZEOF_PY_LONG_LONG 8
#define NPY_SIZEOF_LONGLONG 8
#define NPY_NO_SIGNAL 1
#define NPY_NO_SMP 0
#define NPY_HAVE_DECL_ISNAN
#define NPY_HAVE_DECL_ISINF
#define NPY_ENABLE_SEPARATE_COMPILATION 1
#define NPY_VISIBILITY_HIDDEN
#define NPY_ABI_VERSION 0x01000009
#define NPY_API_VERSION 0x00000009

#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS 1
#endif

EOF

这是完全无法理解的。有解决这个问题的想法吗?

【问题讨论】:

  • 你安装了 numpy 吗?我问的原因是因为错误消息说您没有 BLAS 和 LAPACK (我相信这是 C、Fortran 的线性代数库);所有这些都是使用 numpy 所必需的。你签出this question了吗?
  • 不,我没有安装 numpy。
  • 但是使用 easy_install 它仍然给我同样的错误
  • 我不是 Windows 用户,所以我不确定如何继续。但是,numpy 是一个非常常见的依赖项,因此确保已安装它是第一要务。阅读 numpy web-site 他们推荐 python wia 称为 enthought 的东西,因为这包括 NumPy。否则从sourceforge 下载安装程序。 注意 Atlas、Lapack 不是绝对必要的,编译可能需要数小时我建议安装 python 版本,包括 numpy...
  • 不建议在 Windows 上从源代码编译 pandas(或 numpy),除非您想进行开发设置。您应该安装一个预编译的二进制文件:或者使用 pip 而不是 easy_install (pypi.python.org/pypi/pandas) 从 PyPI 安装一个轮子,或者使用包含 pandas 的 python 发行版(例如 Anaconda 或 Canopy)

标签: python numpy pandas


【解决方案1】:

pandas(和其他各种 python 库)使用 C 语言来完成一些繁重的工作。 Pip 包通常在客户端下载和编译 C 源代码,在 *nix 机器上这很好,因为它们通常有编译器。但是,Windows 不附带编译器默认值。所以你的选择是(从最难到最简单):

  1. 安装一个 C 编译器(如果你不做任何 C 编译器会很烦人)
  2. 安装像 anaconda 或 enthought 这样的 python 发行版,它们会为您处理这些事情(这些很好而且很容易,但您可能已经有一个想要保留的自定义环境)。
  3. 使用 wheel 安装软件包 - 这些是鸡蛋的继承者,不需要在 Windows 上编译。一些包裹已经带有轮子,但不是全部。但是,http://www.lfd.uci.edu/~gohlke/pythonlibs/ 有非官方的轮子集合,您可以下载轮子,然后使用 pip 安装它。

编辑:正如@cel 所建议的那样 - 看在上帝的份上,不要使用 easy_install 请改用 pip - 您需要的许多包已经有 pip 可以找到的轮包。如果你还没有 pip,那么试试easy_install pip(就像使用 Internet Explorer 的唯一原因就是用它来下载另一个浏览器一样;)

【讨论】:

  • 所以你的意思是我应该用微软的可视化编译器嵌入它?像这样taywils.me/2012/12/23/pythonfinance1.html ?
  • 这是一个不错的答案 - 虽然,我认为重点应该是:For god's sake, please don't use easy_install! :)
  • @user3440716 在您链接到的博客文章中,他们不安装编译器(仅 Visual Studio 作为 IDE),而是从预编译的二进制文件安装所有内容(如本文中的步骤 3)。所以最好跳过 1. 并选择 2. 或 3. 之一。
  • 这个问题:github.com/pandas-dev/pandas/issues/13870引用了同样的问题-推荐pip install pandas
猜你喜欢
  • 1970-01-01
  • 2011-07-24
  • 1970-01-01
  • 1970-01-01
  • 2014-12-04
  • 1970-01-01
  • 2014-08-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多