backports.zoneinfo install error:Building wheel for backports.zoneinfo error

2022-08-09 10:38:40 浏览数 (1)

执行命令:

pip install backports.zoneinfo

error内容:

・Building wheel for backports.zoneinfo error

・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/

・C:UserswaterAppDataLocalTemppip-build-env-sdj61qe9overlayLibsite-packagessetuptoolsconfigsetupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.

SetuptoolsDeprecationWarning ⇒setuptool 弃用

解决方案:

pip install --upgrade setuptools

升级setuptools

error 内容

代码语言:javascript复制
(venv) PS D:PycharmProjectspj> pip install backports.zoneinfoCollecting backports.zoneinfo
  Downloading backports.zoneinfo-0.2.1.tar.gz (74 kB)     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.1/74.1 kB 4.0 MB/s eta 0:00:00
  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
  ╰─> [34 lines of output]
      C:UserswaterAppDataLocalTemppip-build-env-sdj61qe9overlayLibsite-packagessetuptoolsconfigsetupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating buildlib.win-amd64-cpython-39
      creating buildlib.win-amd64-cpython-39backports
      copying srcbackports__init__.py -> buildlib.win-amd64-cpython-39backports
      creating buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfo_common.py -> buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfo_tzpath.py -> buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfo_version.py -> buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfo_zoneinfo.py -> buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfo__init__.py -> buildlib.win-amd64-cpython-39backportszoneinfo
      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 'srcbackports.zoneinfo.egg-infoSOURCES.txt'
      copying srcbackportszoneinfo__init__.pyi -> buildlib.win-amd64-cpython-39backportszoneinfo
      copying srcbackportszoneinfopy.typed -> buildlib.win-amd64-cpython-39backportszoneinfo
      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]

解决:

1 安装vs buildtool

安装buildtool

2 pip install --upgrade setuptools

3 pip install backports.zoneinfo

代码语言:javascript复制
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed setuptools-63.4.2

[notice] A new release of pip available: 22.2.1 -> 22.2.2
[notice] To update, run: python.exe -m pip install --upgrade pip


(venv) PS D:PycharmProjectspj> pip install backports.zoneinfo
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) ... done
  Created wheel for backports.zoneinfo: filename=backports.zoneinfo-0.2.1-cp39-cp39-win_amd64.whl size=36442 sha256=9812e976860709bd235b79f8e1d372c8ac7b435d
  Stored in directory: c:userswaterappdatalocalpipcachewheelsf6dac47ac0330c0d9763cbd549898f8815e8
Successfully built backports.zoneinfo
Installing collected packages: backports.zoneinfoSuccessfully installed backports.zoneinfo-0.2.1

[notice] A new release of pip available: 22.2.1 -> 22.2.2
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS D:PycharmProjectspj>

参照:

WindowsCompilers

Which Microsoft Visual C compiler to use with a specific Python version ?

Each Python version uses a specific compiler version (e.g. CPython 2.7 uses Visual C 9.0, CPython 3.3 uses Visual C 10.0, etc). So, you need to install the compiler version that corresponds to your Python version :

Visual C

CPython

14.x

3.5 - 3.10

10.0

3.3 - 3.4

9.0

2.6 - 2.7, 3.0 - 3.2

0 人点赞