If you want to use
pip3 with your Anaconda Python 3 installation, you can copy
[Python 3]/Scripts/ to
pip3-script.py in the same folder. These will then show up in your PATH, so running
pip3 install [x] will now work, and running
pip install [x] will still work for your Python 2 installation.
(Thanks to Neil D. for the tip!)
I can’t take credit for most of this, but modified it slightly to include both network and public IP addresses.
With a Gmail address, you’ll need to allow access for less-secure apps at https://myaccount.google.com. No idea whether you can make it work with 2FA.
Put the script somewhere (
home/pi/scripts/?) and call from
etc/rc.local with a
sleep 30 or similar command so you’re sure it boots up before trying to send.
See https://gist.github.com/johnantoni/8199088 and citations therein for the original concept.