我正在尝试通过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/