【问题标题】:Use the `pip install tornado` on Mac get error:Permission denied: '/Library/Python/2.7/site-packages/singledispatch.py在 Mac 上使用 `pip install tornado` 得到错误:权限被拒绝:'/Library/Python/2.7/site-packages/singledispatch.py
【发布时间】:2017-05-29 01:08:34
【问题描述】:

在 Mac 上使用 pip install tornado 会出错:

aircraftdeMacBook-Pro:~ ldl$ pip install tornado
Collecting tornado
  Downloading tornado-4.5.1.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 565kB/s 
Collecting singledispatch (from tornado)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado)
  Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 565kB/s 
Collecting backports_abc>=0.4 (from tornado)
  Downloading backports_abc-0.5-py2.py3-none-any.whl
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado)
Installing collected packages: singledispatch, certifi, backports-abc, tornado
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 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/singledispatch.py'

【问题讨论】:

    标签: macos tornado


    【解决方案1】:

    经过挣扎,我用sudo pip install tornado解决了。

    Collecting tornado
      Downloading tornado-4.5.1.tar.gz (483kB)
        100% |████████████████████████████████| 491kB 557kB/s 
    Collecting singledispatch (from tornado)
      Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
    Collecting certifi (from tornado)
      Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
        100% |████████████████████████████████| 378kB 641kB/s 
    Collecting backports_abc>=0.4 (from tornado)
      Downloading backports_abc-0.5-py2.py3-none-any.whl
    Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado)
    Installing collected packages: singledispatch, certifi, backports-abc, tornado
      Running setup.py install for tornado ... done
    Successfully installed backports-abc-0.5 certifi-2017.4.17 singledispatch-3.4.0.3 tornado-4.5.1
    

    【讨论】:

      【解决方案2】:

      一般来说,当指令说:

      要安装 package123 运行 pip install package123

      99% 的情况下,它假设包被安装在 Python 虚拟环境中(通过 virtualenvvenv)。话虽如此,您应该在虚拟环境中安装 Tornado 并避免使用sudo pip install tornado。如果您确实使用 sudo,除了使用 3rd 方模块污染您的系统包之外,没有什么不好的事情发生。

      【讨论】:

        【解决方案3】:
        1. 试试pip install tornado
        2. 如果终端出现任何权限错误,请尝试sudo pip install tornado

        【讨论】:

          猜你喜欢
          • 2017-09-25
          • 1970-01-01
          • 2018-01-17
          • 2013-12-29
          • 2014-02-07
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-08-19
          相关资源
          最近更新 更多