【问题标题】:tables package for Python 3.9.1?Python 3.9.1 的表包?
【发布时间】:2021-05-17 02:29:57
【问题描述】:

这是我在这里的第一个问题。非常感谢您的支持。

我在 64 位 Windows 10 机器上使用 Python 3.9.1,我一直在尝试通过 pip install tables 安装 tables 包,但我总是收到以下错误:

pip install tables
Collecting tables
  Using cached tables-3.6.1.tar.gz (4.6 MB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Acer\\AppData\\Local\\Temp\\pip-install-u9bkjlwp\\tables_8a3121807beb4fde8d73782dff1f349e\\setup.py'"'"'; __file__='"'"'C:\\Users\\Acer\\AppData\\Local\\Temp\\pip-install-u9bkjlwp\\tables_8a3121807beb4fde8d73782dff1f349e\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Acer\AppData\Local\Temp\pip-pip-egg-info-9_t31x9b'
         cwd: C:\Users\Acer\AppData\Local\Temp\pip-install-u9bkjlwp\tables_8a3121807beb4fde8d73782dff1f349e\
    Complete output (17 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Acer\AppData\Local\Temp\pip-install-u9bkjlwp\tables_8a3121807beb4fde8d73782dff1f349e\setup.py", line 634, in <module>
        libdir = compiler.has_function(package.target_function,
      File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\ccompiler.py", line 792, in has_function
        objects = self.compile([fname], include_dirs=include_dirs)
      File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\_msvccompiler.py", line 323, in compile
        self.initialize()
      File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\_msvccompiler.py", line 220, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 313, in msvc14_get_vc_env
        return _msvc14_get_vc_env(plat_spec)
      File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 267, in _msvc14_get_vc_env
        raise distutils.errors.DistutilsPlatformError(
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    * Using Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
    * USE_PKGCONFIG: False
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/32/847ee3f521aae6a0be380d923a736162d698586f444df1ac24b98c65025c/tables-3.6.1.tar.gz#sha256=49a972b8a7c27a8a173aeb05f67acb45fe608b64cd8e9fa667c0962a60b71b49 (from https://pypi.org/simple/tables/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我不明白错误消息,但我怀疑它与我的 Python 版本有关。

我确实安装了tables' homepage 上建议的所有必备包,但在安装表格包时仍然出现错误。

我也尝试使用.whl file 进行安装,但没有名称中包含 cp39 的文件(这使我得出结论,Python 3.9 还没有兼容版本,但我可能错了。)

有没有办法用 Python 3.9.1 安装表?非常感谢。

【问题讨论】:

  • 它说您需要“Microsoft Visual C++ 14.0 或更高版本”,它还为您提供了在哪里可以找到它的链接。请安装并检查并重试。
  • 您可以从 Christoph Gohlke 的 Unofficial Windows Binaries for Python Extension Packages 网站获取预构建的 Python 3.9 PyTables 版本。
  • @SURYATEJA 。谢谢您的建议。我尝试按照错误消息中建议的链接安装 Microsoft Visual C++。我仍然收到另一个错误消息。不过,这一次并没有提到缺少 Microsoft Visual C++。
  • @martineau 我尝试按照您的建议进行操作,它奏效了。我现在可以在我的代码中导入表格。谢谢。

标签: python installation windows-10 pytables


【解决方案1】:

我已经从 unofficial Windows binaries 存档下载并安装了 tables-3.6.1-cp39-cp39-win_amd64.whl

pip install tables-3.6.1-cp39-cp39-win_amd64.whl安装它

更新

该软件包已从上述链接中删除。我找到了另一个来源: pypi.bartbroe.re/tables/

【讨论】: