在我的Mac上安装Pandas和yFinance时出现问题,安装了python3.9

2022-05-08 00:00:00 python package libraries yfinance

问题描述

我正在尝试使用python-m pip install yFinance命令来安装yFinance。该命令引用的是python3.9.0

当我尝试执行此操作时,收到以下消息:

Collecting yfinance
  Using cached yfinance-0.1.55.tar.gz (23 kB)
Collecting pandas>=0.24
  Using cached pandas-1.1.3.tar.gz (5.2 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/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 (274 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.1-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)
  Using legacy 'setup.py install' for numpy, since package 'wheel' is not installed.
  Installing collected packages: setuptools, wheel, Cython, numpy
      Running setup.py install for numpy: started
      Running setup.py install for numpy: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py'"'"'; __file__='"'"'/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-record-rc02kt8n/install-record.txt --single-version-externally-managed --prefix /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/overlay --compile --install-headers /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/overlay/include/python3.9/numpy
           cwd: /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/
      Complete output (251 lines):
      Running from numpy source directory.
  
      Note: if you need reliable uninstall behavior, then install
      with pip instead of using `setup.py install`:
  
        - `pip install .`       (from a git repo or downloaded source
                                 release)
        - `pip install numpy`   (last NumPy release on PyPi)
  
  
      blas_opt_info:
      blas_mkl_info:
      customize UnixCCompiler
        libraries mkl_rt not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      blis_info:
      customize UnixCCompiler
        libraries blis not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      openblas_info:
      customize UnixCCompiler
      customize UnixCCompiler
        libraries openblas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      atlas_3_10_blas_threads_info:
      Setting PTATLAS=ATLAS
      customize UnixCCompiler
        libraries tatlas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      atlas_3_10_blas_info:
      customize UnixCCompiler
        libraries satlas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      atlas_blas_threads_info:
      Setting PTATLAS=ATLAS
      customize UnixCCompiler
        libraries ptf77blas,ptcblas,atlas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      atlas_blas_info:
      customize UnixCCompiler
        libraries f77blas,cblas,atlas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      accelerate_info:
      customize UnixCCompiler
        libraries accelerate not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      Library accelerate was not found. Ignoring
      customize UnixCCompiler
        libraries veclib not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
      Library veclib was not found. Ignoring
        FOUND:
          extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
          extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
          define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
        FOUND:
          extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
          extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
          define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      non-existing path in 'numpy/distutils': 'site.cfg'
      lapack_opt_info:
      lapack_mkl_info:
      customize UnixCCompiler
        libraries mkl_rt not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      openblas_lapack_info:
      customize UnixCCompiler
      customize UnixCCompiler
        libraries openblas not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      openblas_clapack_info:
      customize UnixCCompiler
      customize UnixCCompiler
        libraries openblas,lapack not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      flame_info:
      customize UnixCCompiler
        libraries flame not found in ['/Library/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
        NOT AVAILABLE
  
      atlas_3_10_threads_info:
      Setting PTATLAS=ATLAS
      customize UnixCCompiler
        libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries tatlas,tatlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries tatlas,tatlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/lib
      customize UnixCCompiler
        libraries tatlas,tatlas not found in /usr/lib
      <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
        NOT AVAILABLE
  
      atlas_3_10_info:
      customize UnixCCompiler
        libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries satlas,satlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries satlas,satlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/lib
      customize UnixCCompiler
        libraries satlas,satlas not found in /usr/lib
      <class 'numpy.distutils.system_info.atlas_3_10_info'>
        NOT AVAILABLE
  
      atlas_threads_info:
      Setting PTATLAS=ATLAS
      customize UnixCCompiler
        libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries ptf77blas,ptcblas,atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/lib
      customize UnixCCompiler
        libraries ptf77blas,ptcblas,atlas not found in /usr/lib
      <class 'numpy.distutils.system_info.atlas_threads_info'>
        NOT AVAILABLE
  
      atlas_info:
      customize UnixCCompiler
        libraries lapack_atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries f77blas,cblas,atlas not found in /Library/Frameworks/Python.framework/Versions/3.9/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries f77blas,cblas,atlas not found in /usr/local/lib
      customize UnixCCompiler
        libraries lapack_atlas not found in /usr/lib
      customize UnixCCompiler
        libraries f77blas,cblas,atlas not found in /usr/lib
      <class 'numpy.distutils.system_info.atlas_info'>
        NOT AVAILABLE
  
        FOUND:
          extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
          extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
          define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
      /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      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.macosx-10.9-x86_64-3.9
      creating build/src.macosx-10.9-x86_64-3.9/numpy
      creating build/src.macosx-10.9-x86_64-3.9/numpy/distutils
      building library "npymath" sources
      get_default_fcompiler: matching types: '['gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg']'
      customize Gnu95FCompiler
      Could not locate executable gfortran
      Could not locate executable f95
      customize NAGFCompiler
      customize AbsoftFCompiler
      Could not locate executable f90
      Could not locate executable f77
      customize IBMFCompiler
      Could not locate executable xlf90
      Could not locate executable xlf
      customize IntelFCompiler
      Could not locate executable ifort
      Could not locate executable ifc
      customize GnuFCompiler
      Could not locate executable g77
      customize G95FCompiler
      Could not locate executable g95
      customize PGroupFCompiler
      Could not locate executable pgfortran
      don't know how to compile Fortran code on platform 'posix'
      C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
  
      compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c'
      gcc: _configtest.c
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      failure.
      removing: _configtest.c _configtest.o
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py", line 443, in <module>
          setup_package()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py", line 435, in setup_package
          setup(**metadata)
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/core.py", line 171, in setup
          return old_setup(**new_attr)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/install.py", line 62, in run
          r = self.setuptools_run()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
          return distutils_install.run(self)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/install.py", line 546, in run
          self.run_command('build')
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/build.py", line 47, in run
          old_build.run(self)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/build_src.py", line 142, in run
          self.build_sources()
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/build_src.py", line 153, in build_sources
          self.build_library_sources(*libname_info)
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/build_src.py", line 286, in build_library_sources
          sources = self.generate_sources(sources, (lib_name, build_info))
        File "/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/numpy/distutils/command/build_src.py", line 369, in generate_sources
          source = func(extension, build_dir)
        File "numpy/core/setup.py", line 669, in get_mathlib_info
          raise RuntimeError("Broken toolchain: cannot link a simple C program")
      RuntimeError: Broken toolchain: cannot link a simple C program
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py'"'"'; __file__='"'"'/private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-install-zco_j2o6/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-record-rc02kt8n/install-record.txt --single-version-externally-managed --prefix /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/overlay --compile --install-headers /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/overlay/include/python3.9/numpy Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/wf/7bsfd_1x77b12zq1y6w6kd000000gn/T/pip-build-env-qtruga5a/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'"'"'' Check the logs for full command output.

如何修复此问题?是不是跟我用的那个版本有关系呢?以前我对麻木和 pandas 没有任何问题。


解决方案

从10月6日起,NumPy( pandas 依赖项)和Pandas的文件列表都没有显示出Python3.9的轮子。当然,您可以从源代码编译这些包,假设它们可以在使用Python3.9时即用即用--但这需要更多的工作(设置编译器)和时间。

https://pythonspeed.com/articles/switch-python-3.9/

相关文章