I have limited experience with Python and Django on Windows, and now I'm trying to figure out how to deploy my code to Ubuntu 16.04 LTS VPS. After reading various tutorials and lots of answers on SE, I managed to get pretty far (well, for me), but now I'm stuck.
In manual mode (via Putty), I can do the following:
python3
sudo -kS apt-get -y install python3-pip
pip3 install
pip3
sudo -kS pip3 install virtualenv virtualenvwrapper
virtualenv ~/Env/firstsite
ls -l ~/Env/firstsite/bin/python
source ~/Env/firstsite/bin/activate
which python3
So, the virtual environment is correctly created and enabled. I could continue to install Django.
However, when I try to do the same thing automatically, using Paramiko (I execute the commands with paramiko.SSHClient().exec_command(cmd, input_string, get_pty=False), everything goes exactly the same until the last command:
exec_command('which python3')
returns /usr/bin/python3. Therefore, I assume that it source activatedoes not work through Paramiko SSH.
- Why?
- How can I deal with it?
- , venv ( ) ?