-4

I have imported 'langdetect' library in python 3.4.4. This is working successfully in python 3.4.4 shell but when I create a new .py file then it does't work successfully. It shows that ImportError: cannot import name 'detect'. How I solve this problem.

  • 1
    Possible duplicate of [Importing installed package from script raises "AttributeError: module has no attribute" or "ImportError: cannot import name"](https://stackoverflow.com/questions/36250353/importing-installed-package-from-script-raises-attributeerror-module-has-no-at) – SiHa Jul 22 '18 at 09:32

1 Answers1

4

It looks like you have named your own file langdetect.py and then tried to import langdetect. This makes it try to import itself. Rename your file to something else, like testdetect.py.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436