Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在尝试为Python安装Pandas_Python_Pandas_Numpy_Error Handling - Fatal编程技术网

正在尝试为Python安装Pandas

正在尝试为Python安装Pandas,python,pandas,numpy,error-handling,Python,Pandas,Numpy,Error Handling,我似乎无法在我的Macbook上安装Pandas for Python。我已经通过不同的线程试图理解,但一直未能找到解决方案 我使用了pip安装程序 我得到的错误是: xxx-MacBook-Pro:~ edss$ pip install pandas Collecting pandas Using cached pandas-0.22.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_

我似乎无法在我的Macbook上安装Pandas for Python。我已经通过不同的线程试图理解,但一直未能找到解决方案

我使用了
pip安装程序

我得到的错误是:

xxx-MacBook-Pro:~ edss$ pip install pandas
Collecting pandas
  Using cached pandas-0.22.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Collecting numpy>=1.9.0 (from pandas)
  Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied: pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from 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/km/5sv3zt816sl74rb9qcmt0vr40000gn/T/pip-LvWuDt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
更新------

  • 我发现我可以下载Anaconda并使用Spyder

谢谢你们的帮助

试着用
sudo


如果你想知道为什么会出现这个问题,我不同意回答说使用
sudopip安装来绕过权限错误。这并不总是一种安全的方法。在OSX上,您应该能够使用
--user
标志绕过当前错误

因此:

pip安装——用户安装

然而,@Kasramvd在评论中指出,最安全的选择之一是使用虚拟环境

并不是说使用sudo是不好的,只是说当你使用它的时候,你应该了解你在做什么

发件人:

使用sudo运行pip时,使用sudo运行setup.py。换句话说,您可以从Internet以root用户身份运行任意Python代码。如果有人在PyPI上建立了一个恶意项目,而您安装了它,那么您就为攻击者提供了对您的计算机的root访问权限。在对PIP和PYPI的某些修复之前,攻击者还可以在下载可信项目时运行中间人攻击来注入代码。


(这个答案可能有些过时,但第一部分是正确的)

Pip非常不可靠。尝试下载源代码并编译它。这几乎总是有效的


如上所述。先用Sudo试试。这似乎阻止了您的pip安装尝试。

您需要以root用户身份运行它(
sudo pip install
),或者作为一种更安全的方式,您可以在虚拟环境中安装它。