Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4824

General discussion • Re: venv is not activating by .sh file

$
0
0
It's only 2 months I am working with raspberry pi.
I am Trying to run my python file at startup, library and modules are installed in venv.

My code is in home/admin/Downloads/code_dump
and venv is in the same path home/admin/Downloads/code_dump

So far I have tried this

created a launch.sh file on Desktop
launch.sh ->

SHELL=venv/bin/bash
cd ../Downloads/code_dump && . venv/bin/activate && python Suraksha.py

Getting error mediapipe not found, they are installed in virtual if I run venv manually then I is working fine.

My main aim is to run this python file on startup.
Couple of thing you can try:
  1. Call the ptyhon binary that's in the venv's bin directory and let python handle the venv stuff for you:

    Code:

    venv/bin/python Suraksha.py
  2. Is it "venv" or ".venv"? I can't tell if "&& . venv/bin/activate" is a transcription error or exactly what you intend. If it is a transcription error it needs to be "&& source .venv/bin/activate" or the venv won't be activated in the next command(s).
  3. Stop setting $SHELL. I've never explictly done so and I'm not sure that it is required.

Statistics: Posted by thagrol — Sat Mar 02, 2024 3:06 pm



Viewing all articles
Browse latest Browse all 4824

Trending Articles