opencv - 无法安装虚拟python环境

标签 opencv virtualenv homebrew macos-sierra virtualenvwrapper

我正在尝试通过macOS Sierra中的Homebrew在Python 3中安装和使用opencv。我遵循了this tutorial的步骤,但是在键入命令pip install virtualenv virtualenvwrapper之后,我得到了如下所示的异常。

当我第一次尝试安装虚拟环境时,它说找不到pip。我使用sudo easy_install 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 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'

但是使用pip install --user virtualenv virtualenvwrapper后,一切正常。但是在按照给定的here更新源并将其源之后,我得到以下-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
即使关闭终端并在第二行中重新打开它,我仍然看到-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
请帮我 :(

最佳答案

这是一个权限问题。如here所述,您应该使用--user选项:

pip install --user virtualenv virtualenvwrapper

关于opencv - 无法安装虚拟python环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46175897/

相关文章:

pip - Ansible 使用最新版本的 setuptools 和 pip 获取 virtualenv 的正确方法

python - 是否可以更改提示中显示的 python virtualenv 名称?

macos - 在 OSX 10.12 上升级 ffmpeg(或 rust)找不到 make

macos - 尝试在 macOS High Sierra 上使用 Brew 安装 rsync 时出错

c++ - opencv 上的 cvGetCaptureProperty 问题

python - 有没有办法在 openCV 中使用条件内核,仅在条件为真时才更改图像上的像素?

python - 我是使用 `pyvenv` 还是 `virtualenv` 来创建虚拟环境?

macos - 如何使用 Brew 安装最新版本的 Node

c++ - 从直方图中获取颜色 vector maxValue

opencv - 如何在 Windows 中使用 OpenCV 2.3 设置 Eclipse CDT 8?