首页 > 解决方案 > 当我试图在我的 cmd 中安装 pandas 时,我得到了他的错误

问题描述

无法解决错误

C:\Users\AJAY>python -m pip install pandas
    Defaulting to user installation because normal site-packages is not writeable
    Collecting pandas
      Using cached pandas-1.1.3.tar.gz (5.2 MB)
      Installing build dependencies ... error
      ERROR: Command errored out with exit status 1:
       command: 'C:\Program Files\Python39\python.exe' 'C:\Program Files\Python39\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\AJAY\AppData\Local\Temp\pip-build-env-425rumxj\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.15.4; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.15.4; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"''
           cwd: None
      Complete output (592 lines):
      Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and platform_system != "AIX"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment
      Ignoring numpy: markers 'python_version >= "3.8" and platform_system == "AIX"' don't match your environment
      Collecting setuptools
        Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
      Collecting wheel
        Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
      Collecting Cython<3,>=0.29.21
        Using cached Cython-0.29.21-py2.py3-none-any.whl (974 kB)
      Collecting numpy==1.17.3
        Using cached numpy-1.17.3.zip (6.4 MB)
      Building wheels for collected packages: numpy
        Building wheel for numpy (setup.py): started
        Building wheel for numpy (setup.py): finished with status 'error'
        ERROR: Command errored out with exit status 1:
         command: 'C:\Program Files\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\AJAY\\AppData\\Local\\Temp\\pip-install-8fbili41\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\AJAY\\AppData\\Local\\Temp\\pip-install-8fbili41\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\AJAY\AppData\Local\Temp\pip-wheel-9thwik51'
             cwd: C:\Users\AJAY\AppData\Local\Temp\pip-install-8fbili41\numpy\
        Complete output (268 lines):
        Running from numpy source directory.
        blas_opt_info:
        blas_mkl_info:
        No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
        customize MSVCCompiler
          libraries mkl_rt not found in ['C:\\Program Files\\Python39\\lib', 'C:\\', 'C:\\Program Files\\Python39\\libs']
          NOT AVAILABLE

标签: pythonpandaspipwindows-10

解决方案


我认为你的问题是你有 python 3.9,而 numpy 只支持 python 3.8。见这里:https ://docs.scipy.org/doc/scipy/reference/toolchain.html

解决方案是安装正确版本的python,然后安装pandas和numpy。

另一个(更好的)解决方案是使用预装了 numpy 和 pandas的Anaconda


推荐阅读