使用虚拟环境时获得权限被拒绝

时间:2016-11-11 03:42:13

标签: python virtualenv

我试图在virtualenv中的共享主机上安装Open CV 2。

我已经把numpy和所有那些东西都用Pip下载了。我在使用OpenCV2时遇到了一些麻烦

我在ssh会话中运行此命令

(penv)[dire]$ cmake -D MAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$VIRTUAL_ENV/local/ -D PYTHON_EXECTUABLE=$PYTHONPATH/python2.7 -D PYTHON_PACKAGES_PATH=$VIRTUAL_ENV/lib/python2.7/site-packages -D INSTALL_PYTHON_EXAMPLES=ON ..

我得到的错误是

Traceback (most recent call last):
  File "/home/bashtroubles/website.com/public/NNPics/penv/bin/cmake", line 11, in <module>
    sys.exit(cmake())
  File "/home/bashtroubles/website.com/public/NNPics/penv/local/lib/python2.7/site-packages/cmake/__init__.py", line 33, in cmake
    raise SystemExit(_program('cmake', sys.argv[1:]))
  File "/home/bashtroubles/website.com/public/NNPics/penv/local/lib/python2.7/site-packages/cmake/__init__.py", line 29, in _program
    return subprocess.call([os.path.join(CMAKE_BIN_DIR, name)] + args)
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
(penv)[dire]$ 

如果重要的话,这也是我的.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# Load pythonbrew
alias pb='pythonbrew'
export PYTHONPATH=~/.pythonbrew/pythons/Python-2.7.3/lib
[[ -s /home/bashtroubles/.pythonbrew/etc/bashrc ]] && source /home/bashtroubles/.python$

# Load custom python installation
export PATH=~/opt/python-2.7.3/bin:${PATH}
export PYTHONPATH=~/opt/python-2.7.3/lib

具体版本为opencv-2.4.13,python版本为2.7.3

我认为这个问题是因为它使用了

中的python2.7
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception

关于如何在没有许可的情况下实现这一目标的任何想法都会被拒绝?

1 个答案:

答案 0 :(得分:0)

我遇到了这个问题。看起来它试图调用的二进制文件没有被标记为可执行文件。我运行此命令来更改权限

sudo chmod +x -R /usr/local/lib/python2.7/dist-packages/cmake-3.13.3-py2.7-linux-x86_64.egg/cmake/data/bin
相关问题