Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Setting Up a Local Python Environment Installing Python and Python Libraries Locally Using pip

Rabih Atallah
Rabih Atallah
3,405 Points

Question regarding pip

Every time I write: pip install module (a module from python packages) in the IDLE, I receive a syntax error. should I use 'pip install module' in the IDLE or in the terminal. I use a mac.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,989 Points

pip install module should be run on the shell command line prompt. You will get a syntax error trying to run pip as a python command in the interpretor.

Rabih Atallah
Rabih Atallah
3,405 Points

Thanks for the clarification...

Rabih Atallah
Rabih Atallah
3,405 Points

Hi Chris. Please how can I install numpy. I have python 3.4 installed. Whenever I run this command in my Terminal: pip install numpy. I get this :

Rabihs-MacBook-Air:~ rab$ pip install numpy Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python Rabihs-MacBook-Air:~ rab$

but when I import numpy in Python 3.4 , I get an error. It seems MAC OS comes with an embedded Python 2.7 with numpy already installed. How can I transfer numpy to Python 3.4

Chris Freeman
Chris Freeman
Treehouse Moderator 67,989 Points

If you're on a system with Python 2.x as the system default, but also have Python 3.x installed, you need to run pip3 to get the Python 3 version of pip to install into the Python 3 site-packages area. Can you try:

pip3 install numpy

Rabih Atallah
Rabih Atallah
3,405 Points

Thanks so much! it worked