【问题标题】:Downloading pandas on macOS terminal在 macOS 终端上下载 pandas
【发布时间】:2020-07-08 00:36:09
【问题描述】:

我正在学习数据分析课程,我目前正在尝试在 macOS 终端上下载 pandas,但这让我很难过。我已经尝试了从下载自制软件到删除旧文件的所有方法,但仍然没有任何帮助,希望有人能有所帮助!以下是我第一次进入终端时得到的结果

Searching for pandas
Reading https://pypi.org/simple/pandas/
Downloading https://files.pythonhosted.org/packages/31/29/ede692aa6547dfc1f07a4d69e8411b35225218bcfbe9787e78b67a35d103/pandas-1.0.5.tar.gz#sha256=69c5d920a0b2a9838e677f78f4dde506b95ea8e4d30da25859db6469ded84fa8
Best match: pandas 1.0.5
Processing pandas-1.0.5.tar.gz
Writing /tmp/easy_install-ury_vz/pandas-1.0.5/setup.cfg
Running pandas-1.0.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ury_vz/pandas-1.0.5/egg-dist-tmp-PL43Bg
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 13, in <module>
    load_entry_point('setuptools==41.0.1', 'console_scripts', 'easy_install')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 2316, in main
    **kw
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 418, in run
    self.easy_install(spec, not self.no_deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1158, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1144, in run_setup
    run_setup(setup_script, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 44, in _execfile
    code = compile(script, filename, 'exec')
  File "/tmp/easy_install-ury_vz/pandas-1.0.5/setup.py", line 42
    f"numpy >= {min_numpy_ver}",
                              ^
SyntaxError: invalid syntax
arpanbhomia@Arpans-MBP ~ %

【问题讨论】:

  • 您使用的是python 2.7,但pandas 1.0.5仅正式支持“Python 3.6.1及以上、3.7和3.8。”。您要么需要升级到像 3.8 这样的新 python(建议在 2.7 完成后),要么安装更旧版本的 pandas,可能是 0.24

标签: python-3.x pandas terminal


【解决方案1】:

转到here 并为您的计算机下载最新的 Python 版本。安装 Homebrew 后,您也可以从终端安装它,如下所示:

$ brew install python

安装最新的 Python 版本后,再次尝试下载 Pandas:

$ pip3 install pandas

如果您想要更完整的安装,您可以下载 Anaconda,因为它会同时安装 numpy、pandas、python 和其他组件。你可以阅读更多关于它的信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-01
    • 2021-03-15
    • 1970-01-01
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    • 2021-05-20
    • 2019-12-07
    相关资源
    最近更新 更多