Has anyone installed tried pip3 install psycopg2 --user in a shell script so the library can be used by a python script?

has anyone installed tried pip3 install psycopg2 --user in a shell script so the library can be used by a python script in order to connect to aws postgres database