【问题标题】:Unable to install Pandas Library using pip3无法使用 pip3 安装 Pandas 库
【发布时间】:2021-09-11 05:40:33
【问题描述】:

我尝试安装 Pandas 库 uisg pip3 并得到以下错误:

ERROR: Command errored out with exit status 1:
   command: /Users/chaklader/PycharmProjects/OptimizingPublicTransport/producers/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/k4/q3psbyqj0l79b8ch527mr36h0000gp/T/pip-install-brdwlohn/pandas_7fb71e5a5c944478a4b18f60d65daa50/setup.py'"'"'; __file__='"'"'/private/var/folders/k4/q3psbyqj0l79b8ch527mr36h0000gp/T/pip-install-brdwlohn/pandas_7fb71e5a5c944478a4b18f60d65daa50/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/k4/q3psbyqj0l79b8ch527mr36h0000gp/T/pip-wheel-1lu27a0t
       cwd: /private/var/folders/k4/q3psbyqj0l79b8ch527mr36h0000gp/T/pip-install-brdwlohn/pandas_7fb71e5a5c944478a4b18f60d65daa50/
  Complete output (938 lines):


  /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
  Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
  ^
  /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  14 warnings and 4 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pandas
  Running setup.py clean for pandas
Failed to build pandas
Installing collected packages: pandas
  Attempting uninstall: pandas

这里有什么问题以及如何解决它?

【问题讨论】:

  • 曾经考虑过 miniconda/anaconda 吗?
  • @LeiYang 我对 Python 生态不是很熟悉。那么我需要做些什么来解决这个问题呢?如果你能写出答案,这将非常有帮助。
  • 添加了一个答案。
  • 我将它安装在虚拟环境中,错误来自那里。

标签: python pandas pip


【解决方案1】:

我的猜测是您使用的 python 版本太高,请参阅类似问题 1 2

你可以试试python 3.6。在安装软件包之前,您应该始终升级 pip

正如您在 pip 安装日志中看到的那样,它尝试从某些 C/C++ 源代码编译,需要有时不可用的构建工具。

所以我建议你使用anaconda,来自wiki

Anaconda 是 Python 和 R 编程语言的发行版 用于科学计算(数据科学、机器学习应用、 大规模数据处理、预测分析等),旨在 简化包管理和部署。

【讨论】:

    猜你喜欢
    • 2018-01-09
    • 2018-07-13
    • 1970-01-01
    • 2018-08-05
    • 1970-01-01
    • 2018-12-15
    • 1970-01-01
    • 2020-07-17
    • 2021-02-02
    相关资源
    最近更新 更多