【问题标题】:Installing Virtual Environment with PIP for Python Via Mac OS X Terminal通过 Mac OS X 终端使用 PIP for Python 安装虚拟环境
【发布时间】:2016-12-17 03:30:10
【问题描述】:

所以,只是一个简单的问题。我已经在 Mac OS X 终端中通过 Homebrew 为 Python 安装了 Pip。我尝试做的下一件事是通过 pip install virtualenv 安装虚拟环境——这就是我遇到问题的地方。我收到以下错误消息:

 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/virtualenv.py'

有人知道该怎么做吗? 我对这一切都很陌生,所以我完全不知道该怎么做。

谢谢。

【问题讨论】:

  • 你需要root权限才能全局安装包。
  • 要提升您的权限,请将sudo放在您的命令前面,即sudo pip install virtual env

标签: python macos terminal pip


【解决方案1】:

你见过http://softwaretester.info/install-and-upgrade-pip-on-mac-os-x/ 这可能会对你有所帮助,我是 Windows 用户,所以它的命令类似于 pip install package-name 但你必须出现在 Windows 中的 Scripts 文件夹中的 python27 但我不知道关于 mac-os-x 。所以这样做也将你的目录更改为 python27/scripts 然后使用你的 pip 命令


如果对你有帮助的话,请点赞支持

【讨论】:

    最近更新 更多