How to add pip modules installed from command line into PyDev environment?

I installed pip. Then I installed PyDev. Afterwards I installed some packages via pip. Now, when I do import package1 in PyDev, the package1 cannot be found.

How to integrate packages installed via pip into PyDev?

I heard about the PYTHONPATH, but I cannot figure out where does pip install packages (i.e. what is the path to the installed packages?). The OS is OSX. I installed pip via homebrew (as precise as I can remember it).

UPDATE 1:

from [https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python#brewed-python-modules] $(brew --prefix)/lib/pythonX.Y/site-packages doesn't even exist.

Answers


To find out where the package is installed:

> pip show regex
---
Name: regex
Version: 2014.06.28
Location: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requires: 

Then, go to the project properties (i.e. right click on the project => properties => PyDev PYTHONPATH) in PyDev, add external lib source folder. Then refresh (or just rewrite the import regex line and save)


The most practical, long-term solution is to use the method that user @static mentioned for locating pip installed packages: pip show elasticsearch. Then use the location to choose the corresponding python installation in PyDev.

E.g. (on my Mac) if location comes back as /usr/local/lib/python2.7/site-packages I should use the /usr/local/bin/python2.7 during Advanced autoconfig in PyDev > Interpreters > Python Interpreter.

You can see in the Libraries tab that autoconfig pulled in /usr/local/lib/python2.7/site-packages automatically, which means that all your pip installed packages are available for import.


In python, do this:

import site
site.getsitepackages()

Then copy the given directory. Go to Eclipse --> Windows --> PyDev --> Python Interpreter --> Click on New Folder --> Go to the given directory above and add it there.


Need Your Help

Write data to a Open excel sheet

java excel testng filewriter

I am trying to write data into a excel sheet using JAVA, I am able to achieve it when the excel file is closed.

Aligning search bar for mobile and desktop with bootstrap 3.3

html css twitter-bootstrap

I want my search box to appear in the nav bar on the desktop and in mobile. Currently, when I reduce the width, the search bar drops to the next line. I can't figure out how to keep it flush with t...