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

Installing peewee and sqlite

In oder to finish the Python track I need to install the peewee module. But when I try to run "pip install pewee", pip tries to install the module into /usr/local/lib/python2.7. With peewee installed there, Python 3.4 can't find it. So how do I get pip to install to the correct directory?

Also; any tips on installing sqlite?

I ran into this before with the Python pytz module and never really solved it.

1 Answer

If you have python 3.4 installed, you probably just need to use "pip3 install peewee". If not please let us know what OS you are using.

Using a Xubuntu Linux system with the XFCE desktop. Like most Linuxs it has both Python 2.7 and 3.4 installed out of the box. But, as I noted, it tends to favor Python 2.7. I did a PIP install peewee command. And I can import peewee when running Python 2.7. But not when i'm running Python 3.4. Here is the output from the terminal session:

gordon:~$ python2
Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import peewee
>>> 
>>> quit()
gordon:~$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:18) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import peewee
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'peewee'
>>> 

There does not seem to be a pip3 command.

For some reason Ubuntu hasn't shipped python 3 with pip. If you don't use python 2 regularly, you can find instructions at the following link to help get the python 3 version of pip installed. How to install pip for python 3 in ubuntu 12.04 LTS

If you need to use both python2 and python3, the second answer in that link will help you get started using virtualenv's.