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 trialMaya Angelica Gurgiolo
4,268 PointsInstalling pytz
I can't figure out how to install pytz. In the video it says to use 'pip install pytz', but where am I supposed to type this? I've tried the Python shell, the Python command line, and Powershell. I have Python 3.4.
3 Answers
Iain Simmons
Treehouse Moderator 32,305 PointsFirst, make sure both the Python34
directory and its subdirectory Scripts
are in the PATH environment variable (there's an option to add this when installing Python).
Second, try python -m pip install pytz
from Powershell or a regular command prompt.
Maya Angelica Gurgiolo
4,268 PointsThank you so much for your answer! I had Python in PATH but not the Script subdirectory. After changing that I was successfully able to use the 'python -m pip install pytz' command in Powershell.
Iain Simmons
Treehouse Moderator 32,305 PointsGreat! Glad it was something simple! :)
shaunhoyes
17,972 PointsI'm using a Mac with Python 2.7. To install pytz, I opened the program called "Terminal", and then on the first line typed
pip install pytz
. If you're using a Mac, I hope this helps.
Michael Steinman
11,012 PointsI'm having trouble installing this module as well. Unfortunately, I don't understand the answer given. Can someone give step by step instructions on how to do this? I'm using Python 3.5 on Windows. All I know how to do is use the shell (IDLE) and write scripts by clicking File New File from the shell.
Iain Simmons
Treehouse Moderator 32,305 PointsSo there's a sneaky way to install modules from IDLE. Run these commands (one line at a time in IDLE):
from subprocess import call
call("pip install pytz", shell=True)
Then you can carry on with importing the module:
import pytz
Note that you need to import the module each time you use it, but only have to install it once.
Found this from this page on Google Groups: https://groups.google.com/forum/embed/#!topic/python-virtualenv/VsulL00j--8
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 Pointspip install
should be run at in a bash or powershell window. A virtualenv may used within the shell to localize the install to that end. What error are you seeing when trying in powershell?