Karin Lahyani
Karin Lahyani

Reputation: 11

Import external package into pycharm

I'm using pycharm as python2.7 project editor, and I'm trying to import external packages (for example pytz for timezone issues) but for some reason, it doesn't recognize none of the packages I'm trying to import

from pytz import timezone

The Error I get is: ImportError: No module named pytz

I tried all version of pip install pytz, I have even uninstalled the package with pip and reinstalled it with brew. Still - pycharm doesn't recognize my packages.

After I read some solutions here, I saw that my pip installation directs all the packages to be installed in :

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

And my default python interpreter location is

/usr/bin/python

Its seems that the interpreter doesn't recognize the pip installation location.

I'm using mac osx.

Please help me to find a solution .

Upvotes: 1

Views: 1050

Answers (1)

Joran Beasley
Joran Beasley

Reputation: 113988

where it is underlined in red inside pycharm ... just click it so your cursor is on "pytz"(from import pytz) and hit alt+enter , and select install package pytz from the menu that pops up

or go to pycharm file > settings > project > interpreter ... and add the package directly to the interpreter configured with pycharm

Upvotes: 1

Related Questions