From e7f646c3b97e0b860b3a0d4049dc6c07fef9492a Mon Sep 17 00:00:00 2001 From: Andreas Hug Date: Sun, 13 Jul 2014 20:06:19 +0200 Subject: [PATCH 1/2] Use `python3` explicitly On a lot of systems `python` will refer to a parallel Python 2 installation so `python3` should be used when not working in a virtual environment. --- django_installation/README.md | 4 +++- python_installation/README.md | 2 +- python_introduction/README.md | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/django_installation/README.md b/django_installation/README.md index 5e5dd7363da..9a17293ffea 100644 --- a/django_installation/README.md +++ b/django_installation/README.md @@ -22,7 +22,7 @@ where `C:\Python34\python` is folder in which you previously installed Python an Creating `virtualenv` in both Linux and OS X is as simple as typing in console (remember, that we expect that you have python 3.4 installed): - ~$ python -m venv blog + ~$ python3 -m venv blog ### Working with virtualenv @@ -46,6 +46,8 @@ or: so the prefix `(blog)` appears! +When working within a virtual environment, `python` will automatically refer to the correct version so you can use `python` instead of `python3`. + Ok, we have all important things in place. We can finally install Django! ## Installing Django diff --git a/python_installation/README.md b/python_installation/README.md index 3cc3e92d156..d6e821a6dd3 100644 --- a/python_installation/README.md +++ b/python_installation/README.md @@ -20,7 +20,7 @@ You can download Python for Windows from the website https://www.python.org/down It is very likely that you already have Python installed out of the box. To check if you have it installed (and which version it is), you type in a console: - $ python --version + $ python3 --version Python 3.4.1 If you don't have Python installed or you want a different version, you can install it as follows. diff --git a/python_introduction/README.md b/python_introduction/README.md index 4d14ac9e015..646ca6a896b 100644 --- a/python_introduction/README.md +++ b/python_introduction/README.md @@ -8,9 +8,9 @@ Let's write some code! To start tinkering with Python, we need to open up a *prompt* on your computer. On Mac OS X you can do this by launching the `Terminal` application (it's in Applications → Utilities). On Windows you need to go to Start menu → All Programs → Accessories → Command Prompt. On Linux, it's probably under Applications → Accessories → Terminal. -A window should pop up on your screen. This window is a prompt, waiting for commands from you. We want to open up a Python console, so type in `python` and hit Enter. +A window should pop up on your screen. This window is a prompt, waiting for commands from you. We want to open up a Python console, so type in `python3` and hit Enter. - (workshops) ~$ python + (workshops) ~$ python3 Python 3.4.1 (...) Type "copyright", "credits" or "license" for more information. >>> From 87207f7fa71c94cf1041d0fcfefa809c2d3ff53f Mon Sep 17 00:00:00 2001 From: Andreas Hug Date: Sun, 13 Jul 2014 20:14:33 +0200 Subject: [PATCH 2/2] Split up description on how to open the Python console --- python_introduction/README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/python_introduction/README.md b/python_introduction/README.md index 646ca6a896b..9ed88a348b8 100644 --- a/python_introduction/README.md +++ b/python_introduction/README.md @@ -6,19 +6,34 @@ Let's write some code! ## Python prompt -To start tinkering with Python, we need to open up a *prompt* on your computer. On Mac OS X you can do this by launching the `Terminal` application (it's in Applications → Utilities). On Windows you need to go to Start menu → All Programs → Accessories → Command Prompt. On Linux, it's probably under Applications → Accessories → Terminal. +To start tinkering with Python, we need to open up a *prompt* on your computer. How you get there depends on the operating system but once it's open, everything is equal. + +### Windows + +On Windows you need to go to Start menu → All Programs → Accessories → Command Prompt. A window should pop up on your screen. This window is a prompt, waiting for commands from you. We want to open up a Python console, so type in `python3` and hit Enter. - (workshops) ~$ python3 + C:\Users\Name> C:\Python34\python Python 3.4.1 (...) Type "copyright", "credits" or "license" for more information. >>> -After running the python command, the prompt changed to `>>>`. For us it means that for now we may only use commands in the Python language. You don't have to type in `>>>` - Python will do that for you. +### Linux and OX X + +On Mac OS X you can do this by launching the `Terminal` application (it's in Applications → Utilities). On Linux, it's probably under Applications → Accessories → Terminal. + +A window should pop up on your screen. This window is a prompt, waiting for commands from you. We want to open up a Python console, so type in `python3` and hit Enter. + + $ python3 + Python 3.4.1 (...) + Type "copyright", "credits" or "license" for more information. + >>> ## Your first Python command! +After running the Python command, the prompt changed to `>>>`. For us it means that for now we may only use commands in the Python language. You don't have to type in `>>>` - Python will do that for you. + Let's start with something really simple. For example, try typing some math, like `2 + 3` and hit Enter. >>> 2 + 3