【问题标题】:exception error rising in installing virtualenv安装 virtualenv 时出现异常错误
【发布时间】:2017-08-22 13:12:13
【问题描述】:

我正在尝试安装 python virtualenv。 所以我运行了命令

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'

【问题讨论】:

标签: python django exception pip


【解决方案1】:

您正在 Mac 的系统级目录中安装 virtualenv 软件包。 Mac 使用预装的旧版 Python (2.7.10)。要在您确定的系统目录中安装virtualenv 软件包,您需要使用sudo,因为写入系统目录需要提升权限。

sudo pip install virtualenv

另一种选择是使用--user 选项将其安装到用户目录。

pip install --user virtualenv

【讨论】:

  • 天哪,现在我知道我为什么这么讨厌python了。每次我安装某些东西时,都会出现问题。我安装了最新的 python2,最后我可以放心地说 pip install 了。你节省了我无数的时间,谢谢
【解决方案2】:

尝试使用 sudo 运行它:

sudo pip install virtualenv

或者显式调用python命令

python -m pip install virtualenv

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-30
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    相关资源
    最近更新 更多