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

Python

YANG YOU
YANG YOU
5,804 Points

The problem about python version.

Hi! everyone, I meet two problems. One is that no matter what date and time I input, the system will indicate "this is not a valid date and time", even though I am pretty sure that there is no problem with input.

Another question about python version. I cannot install pytz under the environment python 3 or above. The terminal always indicates that "There is no module about pytz". I can import pytz under the environment 2.7, however, I need to change "input" to "raw_input" in that case. But the first problem is still exist.

I really confused. Hope someone can help me. Thanks so much! by the way, I use mac, type program in sublime and run it in terminal.

1 Answer

This is something almost every student runs into...

By default, in Workspaces if you run a file with the python command it will run the program with Python 3.

So if you type:

python --version

in Workspaces it will return Python 3 (or a number bigger).

However, since Python 2 is the default version on a Mac, doing that command will return Python 2 (unless you've customized your computer).

So, either follow along on Workspaces or Set up a local Python Enviroment on a Mac.

After you install Python 3, you should run programs with the python3 command, and not the python command.

I hope this helps. :)

Good luck! ~alex