Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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 在MacOs上安装熊猫。权限错误_Python_Macos_Python 3.x_Pandas_Pip - Fatal编程技术网

Python 在MacOs上安装熊猫。权限错误

Python 在MacOs上安装熊猫。权限错误,python,macos,python-3.x,pandas,pip,Python,Macos,Python 3.x,Pandas,Pip,我正在尝试在mac上安装pandas。我已经安装了python 3.6 在终端中进行pip安装时,出现以下错误: 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 "/

我正在尝试在mac上安装pandas。我已经安装了python 3.6

在终端中进行pip安装时,出现以下错误:

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 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pandas'

您是否可以通过高亮显示错误并按ctrl+k将其编辑为格式化代码块,以便更易于阅读?谢谢

编辑:还有,我只是浏览了一下,底部写着拒绝许可。尝试以管理员身份重新运行该命令。即尝试以下命令:

sudo pip install pandas

您可能已经注意到,Mac附带了一个内置Python,即Python 2.7。如果您阅读回溯:
/Library/Python/2.7/site packages/pip-9.0.1-py2.7.egg/pip/basecommand.py
它指向2.7目录。此目录位于库文件夹中,因此您没有安装该目录的权限


但是您声明也安装了Python3.6,所以如果您想安装到该indtead。执行
pip3安装pandas
python3-m pip安装pandas
这有助于指定python版本。如果您想在终端上运行python 3.6,请键入
python3
,而不仅仅是
python

,很抱歉,这个问题在过去一周内至少被问了3次,请在发布之前尝试谷歌搜索。