python - 在 python 虚拟环境中使用 pip 安装 Pandas 时出现“bz2 模块不可用”

标签 python pandas pip bzip2 pythonbrew

我正在浏览这篇文章Numpy, Scipy, and Pandas - Oh My! ,安装一些 python 包,但在安装 Pandas 时卡住了:

pip install -e git+https://github.com/pydata/pandas#egg=pandas

我将最新版本的“wesm”更改为“pydata”,与该帖子的唯一不同之处在于我使用的是 pythonbrew。

我找到了this post ,与错误有关,但是答案中提到的 bz2 的 Makefile 在哪里?有没有其他方法可以解决这个问题?

任何帮助将非常感激。谢谢。

最佳答案

您需要构建具有 BZIP2 支持的 python。
安装以下包在构建 python 之前 :

  • 红帽/Fedora/CentOS:yum install bzip2-devel
  • Debian/Ubuntu:sudo apt-get install libbz2-dev

  • 提取python tarball。然后
    configure;
    make;
    make install
    
    安装 pip使用新的python。
    备选:
    使用 yum 或 apt 安装二进制 python 发行版,该发行版是使用 BZIP2 支持构建的。
    另见:ImportError: No module named bz2 for Python 2.7.2

    关于python - 在 python 虚拟环境中使用 pip 安装 Pandas 时出现“bz2 模块不可用”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22346269/

    相关文章:

    python - 如何将 stdin 上的输入发送到 Makefile 中定义的 python 脚本?

    python - 如何在 Python 中格式化九位数字的字符串?

    python - Docker 容器中缺少 python 包

    python - Pip 无法安装 github 包 'python-ldap',需要 C++ 10

    pip - 如何升级 disutils 包 PyYAML?

    python - 每次编辑对象时,DateField 都会自行清除

    Numpy 的 Python 列表理解

    python - '值错误 : Nothing can be done for the type <class 'numpy.core.records.recarray' > at the moment' error

    python - 将字符串/文本和 pandas 数据框写入 excel

    python - 如何将数据框转换为以行和列作为 Pandas 键的字典?