0

when I run the work command to get into my cv virtual environment on my pi it displays

pi@raspberrypi:~ $ workon cv
bash: workon: command not found

however when I ssh into my pi from my MacBook and run

pi@raspberrypi:~ $ workon cv

it displays

(cv)pi@raspberrypi:~ $

I'm quite new to raspberry pi's and I did spill some water on it a few days ago but it seems to be working fine, thanks in advanced for the help

  • Apparently the virtual environment setup is not initialised properly. Did you reboot the Pi after installing the virtualenv / virtualenvwrapper modules (which I assume you installed). – Dirk Oct 21 '18 at 19:17
  • yes and I have tried rebooting it multiple times, however when I run commands in the virtual environment off my MacBook everything seems to work okay until I try to install numpy and it crashes (or just takes very long), both times I have tried to install numpy. which is why I tried to do it directly from my pi, which is then when it wouldn't accept the "workon" command @Dirk – emilbowry Oct 21 '18 at 19:25
  • update it has just after 10 mins installed numpy from my MacBook @Dirk – emilbowry Oct 21 '18 at 19:34
  • Where / how is the initialisation for the virtualenvwrapper done? Did you add it to any of the startup / login script? I have added it to ~./bashrc, which will make sure it's done with every login – Dirk Oct 21 '18 at 20:09
  • I did it in the ~/.profile I think @Dirk – emilbowry Oct 21 '18 at 20:23
1

This can happen when you put the activation code for virtualenvwrapper in the wrong bash startup script.

~/.profile is not run on a non-login shell (like the terminal started in the GUI). It is run if you log in using SSH. To have it activated in both situations you can move the code over to ~/.bashrc

NB: the code you have to move looks something like this. This is what's in my .bashrc, but it will be slightly different on your system

export WORKON_HOME=$HOME/dev/virtenv
export PROJECT_HOME=$HOME/dev
source /usr/local/bin/virtualenvwrapper.sh

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.