Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Chris Freeman
Treehouse Moderator 68,468 PointsWorkspaces PATH pointing 'python' to 'python2'. [FIXED!]
UPDATE: should be fixed.
Workspaces PATH ordering puts python2 as python.
TL;DR; Workaround: use python3 to invoke python
Inspecting python in Workspaces....
# Default Python
treehouse:~/workspace$ python
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
# Python3 still available
treehouse:~/workspace$ python3
Python 3.5.0 (default, Jan 8 2016, 01:15:15)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
# Default python coming from /bin
treehouse:~/workspace$ which python
/bin/python
# this points to python2
treehouse:~/workspace$ ls -l /bin/python
lrwxrwxrwx. 1 root root 7 Dec 23 18:09 /bin/python -> python2
# Python3 is in .../shims
treehouse:~/workspace$ which python3
/usr/local/pyenv/shims/python3
treehouse:~/workspace$ ls -l /usr/local/pyenv/shims/python*
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3.5
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3.5-config
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3.5m
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3.5m-config
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python3-config
-rwxr-xr-x. 46 root root 395 Jan 8 01:16 /usr/local/pyenv/shims/python-config
# directory /bin comes before .../shims
treehouse:~/workspace$ echo $PATH
/home/treehouse/.local/bin:/home/treehouse/bin::/bin:/usr/local/pyenv/shims:/usr/local/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Workaround: In Workspaces you can use python3 to invoke python
Chris Freeman
Treehouse Moderator 68,468 PointsFixed title.
Nicolas Hampton
44,725 PointsChris, because python3 can be used to get py3, I feel as though that path might be there on purpose. There's still new uses for py2 syntax, like embedded devices.
Chris Freeman
Treehouse Moderator 68,468 PointsHi Nicolas, thanks for the comment. The PATH issue is a recent change. Support confirmed that this is a bug and they are working to fix it. For workspaces and teaching Python on Treehouse, Python 3 is intended to be the default.
1 Answer
Nathan Williams
Python Web Development Techdegree Student 6,851 PointsHey folks,
Looks like the PATH order changed when we released the latest build of our Workspaces OS image this morning; I'm rebuilding a new Workspaces image with a fix for this, which should be landing shortly.
In the meantime, just s/python/python3/g :)
Regards,
Nathan W
Treehouse Site Ops
Nathan Williams
Python Web Development Techdegree Student 6,851 PointsChris Freeman, thanks a bunch for getting this escalated :)
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsTreehouse support has been contacted.