0

I created my own python package with "python setup.py bdist_wheel" and "pip install /path/to/dist/my_own_package.wheel". After installing it, when importing it, there is error of "SyntaxError: invalid syntax". Could you help? thanks.

>>> import my-modules
  File "<stdin>", line 1
    import my-modules
             ^
SyntaxError: invalid syntax

But there is module installed in Continuum\anaconda3\Lib\site-packages

susanna
  • 1,395
  • 3
  • 20
  • 32

1 Answers1

1

Your module has a minus symbol in the title. That's the reason. Sometimes (nearly never) the underline symbol may be the fault. If you name your module like "myModules" or "modules", there would be no error.

WRONG:

>>> import my-modules

  File "<stdin>", line 1
    import my-modules
             ^
SyntaxError: invalid syntax

VALID:

>>> import myModules

#No error