Depending on your environment, you may already have Python 2 installed (this is true of Mac OSX, for instance). Having installed Python 3, to access it you need to do something like this:
(pyenv)rook: nateford$ python3
Python 3.4.3 (default, Mar 10 2015, 14:53:35)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlwt
>>>
No ImportError
occurs, so we know it worked. To determine what python you're using you can do this:
(pyenv)rook: nateford$ which python
/Users/nateford/virtual_environments/pyenv/bin/python
(pyenv)rook: nateford$ which python3
/Users/nateford/virtual_environments/pyenv/bin/python3
(pyenv)rook: nateford$ python --version
Python 2.7.1
(pyenv)rook: nateford$ python3 --version
Python 3.4.3
(Note your results will vary because I'm using a virtual environment set up on my box.)
This question addresses IDLE for different versions of Python: you should be able to access it based on your version:
(pyenv)rook: nateford$ which idle
/opt/local/bin/idle
(pyenv)rook: nateford$ which idle3
(pyenv)rook: nateford$ which idle3.4
/opt/local/bin/idle3.4
(pyenv)rook: nateford$ which idle3.5
(pyenv)rook: nateford$
(Again, note I'm on the 3.4 version of Python.)
Similarly, when you install packages on the command line, if you are installing them for Python version 3, you are better off using pip3
than pip
. (Technically, there is some subtly here, but for a command line newcomer it's easier to think of it that way.)