首页 > 解决方案 > 无法在 Python3.6 上安装 pandas=0.18.1

问题描述

我正在尝试使用 python 3.6.13 作为约束来设置遗留项目。虽然我在尝试安装 pandas 0.18.1 版时遇到了问题

日志如下:

Collecting numpy==1.11.1 (from -r requirements-remote.txt (line 25))
Using cached https://files.pythonhosted.org/packages/e0/4c/515d7c4ac424ff38cc919f7099bf293dd064ba9a600e1e3835b3edefdb18/numpy-1.11.1.tar.gz
Collecting pandas==0.18.1 (from -r requirements-remote.txt (line 26))
Using cached https://files.pythonhosted.org/packages/11/09/e66eb844daba8680ddff26335d5b4fead77f60f957678243549a8dd4830d/pandas-0.18.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2/setup.py", line 34, in <module>
    _CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
RuntimeError: Python version >= 3.7 required.

标签: python-3.xpandasnumpypython-3.6

解决方案


错误非常明确:Python version >= 3.7 required. 根据您使用的路径3.6(即从 2016 年开始,将在年底达到生命周期结束)。

这似乎来自熊猫试图numpy-1.21.0rc2作为依赖项安装的事实,请参阅回溯(强调我的):

文件“ /var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2 /setup.py”,第 34 行,在

我不确定 pandas 为什么要这样做,但是如果您首先从您的需求文件中安装 numpy,pandas 可能会认为该依赖关系已解决。

pip install numpy==1.11.1
pip install -r requirements-remote.txt

顺便说一句,numpy 1.11.1pandas 0.18.1都没有将 python 3.6 列为受支持的 python 版本,它们最多都有 3.5。它可能仍然有效,但也可能由于 python 3.6太新而失败(我无法对此进行测试 - 抱歉)。您可以尝试将这些依赖项刷新到仍支持 python 3.6 的最高版本:


推荐阅读