Home > Enterprise >  Run python script in virtualenv from bash script
Run python script in virtualenv from bash script

Time:10-12

I am trying to write a script, which starts pgadmin4. The program starts if I run the script python3 web/pgAdmin4.py from its own folder, but that isn't as fast as running a command from $PATH...

I managed to write a shell script based on other answers from different posts, but sadly the virtual environment still doesn't work (I assume).

The shell script:

#!/bin/bash

source ~/pgadmin4/venv/bin/activate
python3 ~/pgadmin4/web/pgAdmin4.py

The output:

enter image description here

CodePudding user response:

If you have followed these installation steps no need to activate the virtual environment. You can call the executable file pgadmin4 under bin directory that will be executed with the pgadmin4 virtual environment:

#!/bin/bash

~/pgadmin4/venv/bin/pgadmin4

CodePudding user response:

The error message you provided indicates that you lack the "flask" module. Please install it through "pip install flask" or "python3 - m pip install flask".

python3 -m pip install flask
  • Related