Search code examples
pythonanacondaconstantstextacy

ImportError: cannot import name 'constants'


I need to import the constants library but it is not working...

import spacy
import pandas
import textacy
import pandas as pd
from pandas import Series
from . import constants

Erreur:

ImportError                               Traceback (most recent call last)
<ipython-input-49-df52595371dd> in <module>()
  4 import pandas as pd
  5 from pandas import Series
----> 6 from . import constants

ImportError: cannot import name 'constants'

I am using anaconda 3 on windows 10 and tried to install this library with the conda:

conda install -c auto constants

But it still does not work...


Solution

  • from . import constants
    

    imports a python file called constants inside your current directory.

    I doubt you installed it in your directory?

    so just do import constants

    . means look in current directory I believe