$ sudo apt-get update
$ sudo apt-get -y upgrade
$ python3 -V
$ sudo apt-get install -y python3-pip
$ sudo apt-get install -y python3-pip
or (for older version)
REF: https://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
$ sudo pip3 install <package_name>
or (for older versions)
$ sudo pip install rethinkdb (for older versions)
$ sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
REF: https://www.rosehosting.com/blog/install-rethinkdb-on-ubuntu-14-04/
$ source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
$ wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install rethinkdb
$ rethinkdb --bind all &
$ sudo pip3 install rethinkdb
or (for older versions)
$ sudo pip install rethinkdb
For python 3.5 or greater use below commands to install pip (if not installed and having problem with python3 packages)
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo python3.5 get-pip.py
REF: https://www.rethinkdb.com/docs/guide/python/
import rethinkdb as r
r.connect('localhost', 28015).repl() r.db('test').table_create('tv_shows').run() r.table('tv_shows').insert({ 'name': 'Star Trek TNG' }).run()
cursor = r.table("tv_shows").run() for doc in cursor: ... print(doc)
cursor = r.table("tv_shows").filter(r.row["name"] == "ShanTest").run() for document in cursor: print(document)
cursor = r.table("tv_shows").filter(r.row["posts"].count() > 2).run() for document in cursor: print(document)
r.db('test').table('tv_shows').get('7644aaf2-9928-4231-aa68-4e65e31bf219').run()
$ sudo apt-get install python-tornado
$ sudo pip3 install ioloop (if needed)
$ sudo pip3 install tornado
or
$ sudo pip install tornado
$ sudo python3 -m pip install tornado
or
$ sudo python -m pip install tornado
$ python3 basic.py
After executing above file, you may access your web page via:
BROWSER: http://localhost:8181/
REFERENCES:
https://www.acmesystems.it/tornado_web_server_python https://www.safaribooksonline.com/library/view/introduction-to-tornado/9781449312787/ch01s02.html