Python import error :No module named Fabric.api? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Python import error :No module named Fabric.api? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am getting the following error:

Traceback (most recent call last):
  File "drayd.py", line 2, in <module>
    from fabric.api import *
**ImportError: No module named fabric.api**

I am runnign my program using:

python drayd.py

These are my imports :

import os,pprint
from fabric.api import *
import time
import argparse
import ConfigParser

I dont have a file named fabric as other answers solution was, I installed fabric using pip but it still doesnt work,any suggestions? I am using the OSX Terminal.

NOTE : I realised that fabric I installed is not linked to python installation ie it does not recognise that fabric is installed by pip. I am using the python version 2.7 default by osx How do I link fabric installation to python?

Answer

The answer to my question is right here :

PIP install and Python path

I had to add the location of my packages( which were installing not in the sys.path) so I had to add them manually Use pip show to find location of the packages and add them to .bash_profile as @Javier Buzzi said I will take the advice and also run my python code from virtualenv.

We are here to answer your question about Python import error :No module named Fabric.api? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji