4

I have installed ipython on my Ubuntu and then I have installed mechanize on the same.
I can able to do

import mechanize

from command prompt. But when I say import mechanize from ipython, it says as no module named mechanize.

mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
self
  • 2,634
  • 3
  • 16
  • 15

1 Answers1

4

I would do this...

In the console:

>>> import mechanize
>>> mechanize.__file__
Some/path/to/mechanize

Then in IPython,

[1] import sys
[2] print sys.path

See if the /Some/path/to/mechanize is in your sys.path.

sberry
  • 128,281
  • 18
  • 138
  • 165
  • thanks it is not in the sys.path. can you tell me how i can add them in sys,path in ubuntu permanently?? – self Mar 28 '12 at 04:46
  • Put this line in `~\.bashrc` file `export PYTHONPATH=`. This one line command should do the job: `$ echo "export PYTHONPATH=" >> ~\.bashrc`. Then restart your OS and check. – Harshith J.V. Mar 28 '12 at 05:42
  • @HarshithJ.V. : i tried same as you explained & also restart the system. still same error – self Mar 28 '12 at 06:51
  • What does `mechanize.__file__` give you? – Thomas K Mar 28 '12 at 16:19