python - 如何使用 easy_install 安装 Pandas ?

标签 python numpy pandas

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

在命令上:

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”之后,它给了我:

在命令上:

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

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

最佳答案

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

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

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

关于python - 如何使用 easy_install 安装 Pandas ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30827190/

相关文章:

Python - 下载美联储路由号码

python - Flask - 将变量从重定向传递到 render_template

python - 根据Python中groupby的第一个和最后一个值的条件创建一个新列

python - 引用正在定义的数据框的列

python - 在 python 中使用 Netcdf4 从 Netcdf 文件中检索 float32 时出现 ValueError 字符串 float

python - groupby、transform 和 NaN 的奇怪结果

python - 使用实例属性作为字典值

Python 的 os.path 库等同于 Groovy

python - numpy.float128 的内部精度是多少?

python - 索引错误: index is out of bounds for axis 0 python numpy