-2

I have installed textract, python-docx, docx using pip.

pip install textract

The packages were successfully installed. I was able to see them when I execute pip list

But when I try to import these packages it shows an import error suggesting that the module does not exist.

import textract
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named textract

I am using a Linux system. What exactly is the issue and how can I start solving it?

  • are you using default python 2.7 or python 3.x in linux??? – Nihal Aug 02 '18 at 10:25
  • 7
    Probably you have installed the package on a different version of python from the one you are calling – Chris_Rands Aug 02 '18 at 10:25
  • 1
    You might be using `python3` try `pip3 install textract` – Hayat Aug 02 '18 at 10:27
  • Run `pip -V` and `python -V` and check whether the Python version matches. – hoefling Aug 02 '18 at 10:32
  • I gave the commands. It says, pip 18.0 from (python 3.5) and Python 2.7.12 – Pratheesh Prakash Aug 02 '18 at 10:41
  • 1
    So you installed `textract` for Python 3.5; `python3 -c "import textract" ` will work fine. If you need `textract` for Python 2.7, use `pip2`: `pip2 install textract`. You may need to install `pip2` first, e.g. `apt install python-pip`, depending on linux distro. – hoefling Aug 02 '18 at 11:25

1 Answers1

1

Try:

python -m pip install packagename

You will use python2's pip and the package will install for that version.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Stef van der Zon
  • 633
  • 4
  • 13