If you're running this from the CLI during development, you should already have python 3.5 on your server. If not then run sudo apt-get install python3
. To run the app:
python3 app.py
However, since you are asking about virtualenv
--which using is very good practice--you could create a new environment specifying the path of python3, as stated here. If you don't know the path, run which python3
. For my computer, running Ubuntu 16.04:
virtualenv -p /usr/bin/python3 <path/to/new/virtualenv/>
Then:
source <env_name>/bin/activate
Now, this is not a very good setup even for dev and would be absolutely terrible for production. I would suggest using uWSGI
and NGINX
to serve your app. You can specify your virtualenv
path in your uWSGI
config--I would suggest using a .ini file. Here is a very good Digital Ocean tutorial that I used to get started. It won't teach you everything, but it should put you on the right path. There's a lot of resources for this configuration online, so you should be able to solve any problems you run into.