【问题标题】:I keep having issues when installing pandas安装熊猫时我一直遇到问题
【发布时间】:2018-07-18 02:19:27
【问题描述】:

我以前使用过 pandas,但暂时没有。 我有它用于 Python 2,最近升级到 Python 3,所以我不确定这是否是根本问题。

当我执行 pip install pandas 时,我收到以下错误消息:

Installing collected packages: numpy, pandas
  Found existing installation: numpy 1.8.0rc1
    DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling numpy-1.8.0rc1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/f1/v91lpd7j2ls5tbs3qlbr0q5c0000gn/T/pip-DTCBbT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

【问题讨论】:

  • 您是否要安装到您的 Python 3 解释器?你有没有考虑过使用像 Anaconda 这样的东西?
  • 您要为哪个 python 版本安装它?您是否已经在另一个版本上安装了这些库?
  • 你试过使用sudo pip install pandas吗?
  • 希望比我更有知识的人能纠正我:如果 Python 2.7 是默认系统 Python,pip install 会尝试安装到 Python2,对吗?因此,运行 pip3 install 会安装到 Python 3 吗?我想我最初是在这里看到这个花絮的:stackoverflow.com/a/40036679/6672746
  • pip3 安装成功!

标签: python python-3.x python-2.7 pandas numpy


【解决方案1】:

使用sudo命令安装模块:

[usr@osx ~] sudo pip install pandas

编辑:

根据您问题中的信息

[usr@osx ~] sudo pip install pandas

pandas 安装到您的 Python 2.7 解释器,如果您想为您的 Python 3 解释器安装它,那么您需要运行以下命令:

[usr@osx ~] sudo python3 -m pip install pandas

【讨论】:

  • 我试过 sudo 但没有用;我得到了同样的错误。但是,我刚刚尝试了 pip3 安装,它成功了!
  • 很高兴知道。我很高兴你让它工作。我应该删除这个答案吗?
  • 嗯,它可能会帮助别人!
猜你喜欢
  • 2021-11-11
  • 2023-03-12
  • 1970-01-01
  • 1970-01-01
  • 2020-05-31
  • 2019-12-06
  • 2019-04-12
  • 2020-08-14
  • 1970-01-01
相关资源
最近更新 更多