python 为backports-zoneinfo构建控制盘失败

dy1byipe  于 2023-05-27  发布在  Python
关注(0)|答案(1)|浏览(535)

编辑

由于错误行Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)(可能缓存的版本已损坏/旧,与其他软件包不兼容),我尝试了clearing my pip cache-但除了删除该行外,这没有任何区别

上下文

我在安装Python 3.9后遇到了依赖性问题(在这里和这里讨论)。链接帖子中的问题已经修复,但我正在卸载并重新安装我的pip安装包,以确保它们与我的新python版本兼容。我正在尝试使用的一个包是backports-zoneinfo。我知道我是don't really need this,但我还是打算保留它,以防我写的东西需要与旧的python版本兼容。

问题:

我已经卸载了backports-zoneinfo,然后试图重新安装它,但在这篇文章的底部得到错误消息。然后我按照错误信息安装了build tools 2022,并试图再次重新安装backports-zoneinfo,但得到了相同的错误。有人能帮我诊断和解决这个问题吗?

卸载消息:

C:\Users\u03132tk>pip uninstall backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Found existing installation: backports.zoneinfo 0.2.1
Uninstalling backports.zoneinfo-0.2.1:
  Would remove:
    c:\anaconda3\lib\site-packages\backports.zoneinfo-0.2.1.dist-info\*
    c:\anaconda3\lib\site-packages\backports\*
  Would not remove (might be manually added):
    c:\anaconda3\lib\site-packages\backports\functools_lru_cache.py
    c:\anaconda3\lib\site-packages\backports\tempfile.py
    c:\anaconda3\lib\site-packages\backports\weakref.py
Proceed (Y/n)? Y
  Successfully uninstalled backports.zoneinfo-0.2.1

重新安装错误

C:\Users\u03132tk>pip install backports-zoneinfo
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
Collecting backports-zoneinfo
  Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: backports-zoneinfo
  Building wheel for backports-zoneinfo (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for backports-zoneinfo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [46 lines of output]
      C:\Users\u03132tk\AppData\Local\Temp\pip-build-env-0o6uoggk\overlay\Lib\site-packages\setuptools\config\setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!

              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.

              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************

      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\backports
      copying src\backports\__init__.py -> build\lib.win-amd64-cpython-39\backports
      creating build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\_common.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\_tzpath.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\_version.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\_zoneinfo.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\__init__.py -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      running egg_info
      writing src\backports.zoneinfo.egg-info\PKG-INFO
      writing dependency_links to src\backports.zoneinfo.egg-info\dependency_links.txt
      writing requirements to src\backports.zoneinfo.egg-info\requires.txt
      writing top-level names to src\backports.zoneinfo.egg-info\top_level.txt
      reading manifest file 'src\backports.zoneinfo.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.png' under directory 'docs'
      warning: no files found matching '*.svg' under directory 'docs'
      no previously-included directories found matching 'docs\_build'
      no previously-included directories found matching 'docs\_output'
      adding license file 'LICENSE'
      adding license file 'licenses/LICENSE_APACHE'
      writing manifest file 'src\backports.zoneinfo.egg-info\SOURCES.txt'
      copying src\backports\zoneinfo\__init__.pyi -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      copying src\backports\zoneinfo\py.typed -> build\lib.win-amd64-cpython-39\backports\zoneinfo
      running build_ext
      building 'backports.zoneinfo._czoneinfo' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for backports-zoneinfo
Failed to build backports-zoneinfo
ERROR: Could not build wheels for backports-zoneinfo, which is required to install pyproject.toml-based projects
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
yrwegjxp

yrwegjxp1#

要真正修复这个特定的错误,你需要在你的windows机器上有一个工作的编译器:
需要Microsoft Visual C++ 14.0或更高版本。使用“Microsoft C++ Build Tools”获取:https://visualstudio.microsoft.com/visual-cpp-build-tools/
为此,您需要按照链接,下载并安装构建工具,然后重试。
这个特殊的pip包没有python3.9的whl文件,同时有一个源发行版,其中有用C/C++编写的部分。因此,pip现在需要调用编译器来为您的机器构建源代码发行版。
为了避免这种情况,你有几个选择:
1.您可以尝试使用conda install -c conda-forge backports.zoneinfo安装相同的软件包,而不是pip
1.由于zoneinfo已经成为stdlib的一部分,您也可以尝试将import backports.zoneinfo替换为import zoneinfo。使用此方法,您将不需要进一步安装。

相关问题