Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't activate virtualenv as non root user

I can activate my virtualenv only as root user:

source myprojectenv/bin/activate
-sh: 80: source: not found

sudo su
root@ubuntu-serv:/home/user/project# source myprojectenv/bin/activate
(myprojectenv) root@ubuntu-serv:/home/user/project#

How can I fix it? I need it for Fabric deployment as non root user:

def production():
    env.host_string = 'xxx.xxx.xxx.xx'
    env.user = 'username'
    path = "/home/username/project/project"
    cd("home/username/project")
    run("sudo source projectenv/bin/activate")
like image 846
paolo Avatar asked Oct 20 '25 01:10

paolo


1 Answers

Use the following syntax to activate the virtualenv

. myprojectenv/bin/activate

the sh shell does not have the source command.

like image 153
szaboat Avatar answered Oct 22 '25 16:10

szaboat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!