====== Ways to run Python ======
===== OSX =====
* **default configuration** (python2.7):
/usr/bin/python
is normally going to run python2.7, linked like this /usr/bin/python2.7@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
when using this native version of python, some dependences might run into permission problems and thus installing modules via pip requires an extra flag "--user" which installs it only for the current users
* **pyhton3**: osx comes with python3 installed, which can be called with
$ python3
* **conda** is a package and environment management system for Python, R, Node.js, Java and other application stacks.
Install conda for the system and version of choice. On OSX also run:
export PATH="$HOME/anaconda3/bin:$PATH"
Create an environment (-n name) using a specified python version
conda create -n myenv python=3.4
On managing (python) environments with conda: https://conda.io/docs/user-guide/tasks/manage-environments.html
* **virualenv** is a python module installed using
pip install --user virtualenv
virtualenv --python python3 env
source env/bin/activate
some instructions: http://www.pythonforbeginners.com/basics/how-to-use-python-virtualenv
* **docker**
docker run -it -p 8888:8888 -p 6006:6006 -v sharedfolder:/root/sharedfolder floydhub/dl-docker:cpu bash
root@4aa86b7ed9d6:~# jypiter notebook
bash: jypiter: command not found
root@4aa86b7ed9d6:~# jupyter notebook
====== ipython goodies ======
run any shell command starting with %
for example, list files by size, or move a file to another location:
%ls -lhS
%mv a_file.extension newlocation/
load in an external .py file:
%load file_name.py
and call any function defined in it.
====== pygame ======
get key from a user input as pygame.event
http://content.gpwiki.org/index.php/Python:Pygame_keyboard_input