!/usr/bin/env python3
import bcrypt
import sys
passwd = sys.argv[1].encode('utf8')
salt = bcrypt.gensalt(rounds=16)
hashed = bcrypt.hashpw(passwd, salt)

Top tip for python novices: Don't name your python file 'bcrypt.py' as I did. It tries to tries to import itself, or something, rather than the system bcrypt.

MYSQL command to set the new password.

update users set password='hashedpassword' where id=1;