Home > Enterprise >  AttributeError: module 'semver' has no attribute 'compare' [Python-Gitlab]
AttributeError: module 'semver' has no attribute 'compare' [Python-Gitlab]

Time:10-20

I'm getting this error in vscode.

AttributeError: module 'semver' has no attribute 'compare'

  1. Python version: Python 3.10.6
  2. Pip version: pip 22.3
  3. semver version: 2.8.1
    import semver
    
    def is_equals():
        result = semver.compare('0.0.1', '1.0.0')

CodePudding user response:

You should check your filename. Gives error if "semver" is same as filename

Rename your python filename And pip install semver

CodePudding user response:

This error is shown when there is no module or fuction of that type in the library you ask for in your code, It looks like you you have not install it correct.

try to run the pip install semver commed in the cmd.

  • Related