我试图在树莓派上安装Open Cv。我按照本教程https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/
进行了操作我最终在中间得到一个错误,我成功安装了virtualenv和virtualenvwrapper我可以看到,但当我输入配置文件的命令时,我得到一个错误说usr / bin / python:没有名为virtualenvwrapper的模块 virtualenvwrapper.sh:运行初始化挂钩时出现问题。
如果Python无法导入模块virtualenvwrapper.hook_loader, 检查是否已安装virtualenvwrapper VIRTUALENVWRAPPER_PYTHON = / usr / bin / python和PATH是 设置得当。
pi@raspberrypi:~ $ sudo pip install virtualenv virtualenvwrapper
Requirement already satisfied: virtualenv in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: virtualenvwrapper in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: stevedore in /usr/local/lib/python3.5/dist-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv-clone in /usr/local/lib/python3.5/dist-packages (from virtualenvwrapper)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.5/dist-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from stevedore->virtualenvwrapper)
pi@raspberrypi:~ $ VIRTUALENVWRAPPER_PYTHON
bash: VIRTUALENVWRAPPER_PYTHON: command not found
pi@raspberrypi:~ $ echo $VIRTUALENVWRAPPER_PYTHON
pi@raspberrypi:~ $ echo $VIRTUALENVWRAPPER_PYTHON
pi@raspberrypi:~ $ echo $VIRTUALENV_PYTHON
pi@raspberrypi:~ $ echo $VIRTUALENV_PYTHON3
pi@raspberrypi:~ $ sudo pip install virtualenv virtualenvwrapper
Requirement already satisfied: virtualenv in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: virtualenvwrapper in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: stevedore in /usr/local/lib/python3.5/dist-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv-clone in /usr/local/lib/python3.5/dist-packages (from virtualenvwrapper)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.5/dist-packages (from stevedore->virtualenvwrapper)
pi@raspberrypi:~ $ sudo rm -rf ~/.cache/pip
pi@raspberrypi:~ $ echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.profile
pi@raspberrypi:~ $ echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.profile
pi@raspberrypi:~ $ echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
pi@raspberrypi:~ $ source ~/.profile
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
bash: /usr/bin/virtualenvwrapper.sh: No such file or directory
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
pi@raspberrypi:~ $ cat ~/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# virtualenv and virtualenvwrapper
export WORKON_HOME=/home/pi/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
# virtualenv and virtualenvwrapper
export WORKON_HOME=/home/pi/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper.sh
# virtualenv and virtualenvwrapper
export WORKON_HOME=/home/pi/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
pi@raspberrypi:~ $ nano ~/.profile
pi@raspberrypi:~ $ source ~/.profile
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
pi@raspberrypi:~ $
如何解决此问题以继续下载?
答案 0 :(得分:0)
这可能是因为系统指向Python2而不是Python3。 尝试打开〜/ .profile并指向特定版本,如下所示:
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.5