Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

python - ImportError: No module named pandas

I am trying to write code in Python to fetch Twitter data, and I am not getting an error for twython. But I am getting an error for Pandas.

I have installed Pandas using pip install pandas. But I still get the following error. How can I fix it?

F:> pip install pandas
Collecting pandas
c:python27libsite-packagespip\_vendor
equestspackagesurllib3utilssl_.py
:90: InsecurePlatformWarning: A true SSLContext object is not available. This pr
events urllib3 from configuring SSL appropriately and may cause certain SSL conn
ections to fail. For more information, see https://urllib3.readthedocs.org/en/la
test/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pandas-0.17.0-cp27-none-win32.whl
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in c:pyth
on27libsite-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:
python27libsite-packages (from pandas)
Collecting numpy>=1.7.0 (from pandas)
  Downloading numpy-1.10.1.tar.gz (4.0MB)
    100% |################################| 4.1MB 26kB/s
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in c:python2
7libsite-packages (from python-dateutil->pandas)
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy
  Complete output from command c:python27python.exe -c "import setuptools;__fi
le__='c:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\setup.p
y';exec(compile(open(__file__).read().replace('
', '
'), __file__, 'exec'))"
 bdist_wheel -d c:userssangramappdatalocalempmppmwkw4pip-wheel-:
  Running from numpy source directory.
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for numpy
Failed to build numpy
Installing collected packages: numpy, pandas
  Running setup.py install for numpy
    Complete output from command c:python27python.exe -c "import setuptools, t
okenize;__file__='c:\users\sangram\appdata\local\temp\pip-build-m6knxg\nu
mpy\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().rep
lace('
', '
'), __file__, 'exec'))" install --record c:userssangramappdat
alocalemppip-ll4zaf-recordinstall-record.txt --single-version-externally-ma
naged --compile:
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['c:\python27\lib', 'C:\', 'c:\py
thon27\libs']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['c:\python27\lib', 'C:\', 'c:\python2
7\libs']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['c:\python27\lib', 'C:\', 'c:\python27
libs']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['c:\python27\lib', 'C:\', 'c:\python27
libs']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['c:\python27\lib', 'C:\
', 'c:\python27\libs']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['c:\python27\lib', 'C:\', '
c:\python27\libs']
      NOT AVAILABLE

    blas_info:
      libraries blas not found in ['c:\python27\lib', 'C:\', 'c:\python27\l
ibs']
      NOT AVAILABLE

    blas_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    non-existing path in 'numpy\distutils': 'site.cfg'
    F2PY Version 2
    lapack_opt_info:
    openblas_lapack_info:
      libraries openblas not found in ['c:\python27\lib', 'C:\', 'c:\python2
7\libs']
      NOT AVAILABLE

    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in ['c:\python27\lib', 'C:\', 'c:\py
thon27\libs']
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas,tatlas not found in c:python27lib
      libraries lapack_atlas not found in c:python27lib
      libraries tatlas,tatlas not found in C:
      libraries lapack_atlas not found in C:
      libraries tatlas,tatlas not found in c:python27libs
      libraries lapack_atlas not found in c:python27libs
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries satlas,satlas not found in c:python27lib
      libraries lapack_atlas not found in c:python27lib
      libraries satlas,satlas not found in C:
      libraries lapack_atlas not found in C:
      libraries satlas,satlas not found in c:python27libs
      libraries lapack_atlas not found in c:python27libs
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in c:python27lib
      libraries lapack_atlas not found in c:python27lib
      libraries ptf77blas,ptcblas,atlas not found in C:
      libraries lapack_atlas not found in C:
      libraries ptf77blas,ptcblas,atlas not found in c:python27libs
      libraries lapack_atlas not found in c:python27libs
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries f77blas,cblas,atlas not found in c:python27lib
      libraries lapack_atlas not found in c:python27lib
      libraries f77blas,cblas,atlas not found in C:
      libraries lapack_atlas not found in C:
      libraries f77blas,cblas,atlas not found in c:python27libs
      libraries lapack_atlas not found in c:python27libs
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in ['c:\python27\lib', 'C:\', 'c:\python27
libs']
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
 options
    running build_src
    build_src
    building py_modules sources
    creating build
    creating buildsrc.win32-2.7
    creating buildsrc.win32-2.7
umpy
    creating buildsrc.win32-2.7
umpydistutils
    building library "npymath" sources
    Running from numpy source directory.
    c:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1651: 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:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1660: 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:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1663: 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__)
    c:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1552: 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:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1563: 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:userssangramappdatalocalemppip-build-m6knxg
umpy
umpydistutilss
ystem_info.py:1566: 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:python27libdistutilsdist.py:267: UserWarning: Unknown distribution opt
ion: 'define_macros'
      warnings.warn(msg)
    error: Unable to find vcvarsall.bat

    ----------------------------------------
Command "c:python27python.exe -c "import setuptools, tokenize;__file__='c:\us
ers\sangram\appdata\local\temp\pip-build-m6knxg\numpy\setup.py';exec(comp
ile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __fi
le__, 'exec'))" install --record c:userssangramappdatalocalemppip-ll4zaf-
recordinstall-record.txt --single-version-externally-managed --compile" failed
with error code 1 in c:userssangramappdatalocalemppip-build-m6knxg
umpy

F:>python tweet_fetcher.py
Traceback (most recent call last):
  File "tweet_fetcher.py", line 1, in <module>
    import pandas
ImportError: No module named pandas
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You're missing a few (not terribly clear) steps. Pandas is distributed through pip as a wheel, which means you need to do:

pip install wheel
pip install pandas

You're probably going to run into other issues after this - it looks like you're installing on Windows which isn't the most friendly of targets for NumPy, SciPy, and Pandas. Alternatively, you could pickup a binary installer from here.

You also had an error installing NumPy. Like before, I recommend grabbing a binary installer for this, as it's not a simple process. However, you can resolve your current error by installing this package from Microsoft.

While it's completely possible to get a perfect environment setup on Windows, I have found the quality-of-life for a Python developer is vastly improved by setting up a Debian VM. Especially with the scientific packages, you will run into many cases like this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

1.4m articles

1.4m replys

5 comments

57.0k users

...