ImportError: Geen module met de naam panda’s

Ik probeer code in Python te schrijven om Twitter-gegevens op te halen, en ik krijg geen foutmelding voor twython. Maar ik krijg een foutmelding voor Panda’s.

Ik heb Panda’s geïnstalleerd met behulp van pip install pandas. Maar ik krijg nog steeds de volgende foutmelding. Hoe kan ik het oplossen?

F:\> pip install pandas
Collecting pandas
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.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
on27\lib\site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\
python27\lib\site-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
7\lib\site-packages (from python-dateutil->pandas)
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy
  Complete output from command c:\python27\python.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('\r\n', '\n'), __file__, 'exec'))"
 bdist_wheel -d c:\users\sangram\appdata\local\temp\tmppmwkw4pip-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:\python27\python.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('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\sangram\appdat
a\local\temp\pip-ll4zaf-record\install-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:\python27\lib
      libraries lapack_atlas not found in c:\python27\lib
      libraries tatlas,tatlas not found in C:\
      libraries lapack_atlas not found in C:\
      libraries tatlas,tatlas not found in c:\python27\libs
      libraries lapack_atlas not found in c:\python27\libs
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE
    atlas_3_10_info:
      libraries satlas,satlas not found in c:\python27\lib
      libraries lapack_atlas not found in c:\python27\lib
      libraries satlas,satlas not found in C:\
      libraries lapack_atlas not found in C:\
      libraries satlas,satlas not found in c:\python27\libs
      libraries lapack_atlas not found in c:\python27\libs
    <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:\python27\lib
      libraries lapack_atlas not found in c:\python27\lib
      libraries ptf77blas,ptcblas,atlas not found in C:\
      libraries lapack_atlas not found in C:\
      libraries ptf77blas,ptcblas,atlas not found in c:\python27\libs
      libraries lapack_atlas not found in c:\python27\libs
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE
    atlas_info:
      libraries f77blas,cblas,atlas not found in c:\python27\lib
      libraries lapack_atlas not found in c:\python27\lib
      libraries f77blas,cblas,atlas not found in C:\
      libraries lapack_atlas not found in C:\
      libraries f77blas,cblas,atlas not found in c:\python27\libs
      libraries lapack_atlas not found in c:\python27\libs
    <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 build\src.win32-2.7
    creating build\src.win32-2.7\numpy
    creating build\src.win32-2.7\numpy\distutils
    building library "npymath" sources
    Running from numpy source directory.
    c:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy\numpy\distutils\s
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:\python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution opt
ion: 'define_macros'
      warnings.warn(msg)
    error: Unable to find vcvarsall.bat
    ----------------------------------------
Command "c:\python27\python.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('\r\n', '\n'), __fi
le__, 'exec'))" install --record c:\users\sangram\appdata\local\temp\pip-ll4zaf-
record\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in c:\users\sangram\appdata\local\temp\pip-build-m6knxg\numpy
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

Antwoord 1, autoriteit 100%

Je mist een paar (niet erg duidelijke) stappen. Pandas wordt via pip gedistribueerd als een wiel, wat betekent dat je het volgende moet doen:

pip install wheel
pip install pandas

Hierna zul je waarschijnlijk andere problemen tegenkomen – het lijkt erop dat je op Windows installeert, wat niet het meest vriendelijke doelwit is voor NumPy, SciPyen Panda’s. U kunt ook een binair installatieprogramma ophalen van hier.

Je had ook een fout bij het installeren van NumPy. Zoals eerder raad ik aan hiervoor een binair installatieprogrammate gebruiken, aangezien dit niet het geval is een eenvoudig proces. U kunt uw huidige fout echter oplossen door dit pakket te installerenvan Microsoft.

Hoewel het heel goed mogelijk is om een perfecte omgeving te installeren op Windows, heb ik gemerkt dat de kwaliteit van leven voor een Python-ontwikkelaar enorm wordt verbeterd door het opzetten van een DebianVM. Vooral met de wetenschappelijke pakketten zul je veel van dit soort gevallen tegenkomen.


Antwoord 2, autoriteit 20%

Ik had net het probleem en ik bleef installeren en verwijderen. Het blijkt dat het probleem optreedt wanneer u Pandasinstalleert naar een versie van pythonen probeert het programma uit te voeren met een andere python version.

Dus om te beginnen, ren:

which python
python --version
which pip

zorg ervoor dat beide zijn uitgelijnd, hoogstwaarschijnlijk is python 2.7en werkt pip aan 3.xof komt pip van anaconda’s python-versie, wat zeer waarschijnlijk is wees ook 3.x

In het geval van python-omleidingen naar 2.7 en pip-omleidingen naar pip3, installeer panda’s met behulp van pip install pandasen gebruik python3 file_name.pyom het programma uit te voeren.


Antwoord 3, autoriteit 19%

Ik heb hetzelfde probleem opgelost met de onderstaande opdrachten…

Type pythonop uw terminal. Als u Python-versie 2.X ziet, voert u deze twee opdrachten uit om Pandas te installeren:

sudo python -m pip install wheel

en

sudo python -m pip install pandas

anders als u Python-versie 3.X ziet, voert u deze twee opdrachten uit om Pandas te installeren:

sudo python3 -m pip install wheel

en

sudo python3 -m pip install pandas

Veel succes!


Antwoord 4, Autoriteit 6%

Wanneer ik probeer de Docker-afbeelding zeppelin-highcharts , Ik vind dat het basisbeeld OpenJDK: 8 ook geen panda’s heeft geïnstalleerd. Ik heb het met deze stappen opgelost.

curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python
pip install pandas

Ik verwees naar Wat is de officiële “gewenste” manier om PIP- en VIRUALENV-systeemwide te installeren? .


Antwoord 5, Autoriteit 3%

Als u Python-versie 3.9 gebruikt, werkt Panda’s niet vanaf nu. Installeer dus Python-versie 3.7 of hieronder om dit probleem te verzachten.

of anders als u bij Python 3.9 wilt vasthouden, probeer Panda’s te installeren door de bibliotheek te compileren.


Antwoord 6

Vanaf de 2020 had ik hetzelfde probleem bij het installeren van python v 3.8.6via pyenv. Dus ik ben begonnen met:

  1. Pyenv installeren via homebrew , brew install pyenv
  2. Installeer XZ Compiling-pakket via brew install xz
  3. pyenv install 3.8.6. Kies de vereiste versie
  4. pyenv global 3.8.6. Maak deze versie als globaal
  5. python -m pip install -U pipom PIP
  6. te upgraden

  7. pip install virtualenv

Daarna initialiseerde ik mijn nieuwe env, geïnstalleerde Panda’s via de opdracht PIP en alles werkte opnieuw. De geïnstalleerde Panda’s-versie is 1.1.5 binnen mijn werkprojectdirectory.

Opmerking: als u Python vóór XZ hebt geïnstalleerd, moet u het eerst verwijderen, anders kan de fout blijven bestaan.


Antwoord 7

Als u op Ubuntu bent en de ingebouwde Python 3 gebruikt, kunt u het gewoon installeren van de Ubuntu-repos, zoals in een terminal:

sudo apt install python3-pandas

Het bovenstaande werkt op Ubuntu 20.04 LTS en wees enigszins anders, afhankelijk van uw versie.


Antwoord 8

Voor mij hoe het werkte was, had ik twee uitvoerbare versies van Python, dus op PIP-installatie was het installeren in één versie, maar mijn uitvoerbare padversie was anders, dus het mislukte.

Dan heb ik het pad in de omgeving van SYS-omgeving gewijzigd en geïnstalleerd in de uitvoerbare versie van Python en het was in staat om het pakket van site-pakketten te identificeren.


Antwoord 9

TENTE USANDO:

Python-m PIP-installatie Panda’s

Other episodes