ImportError: cannot import name 'Bitrix24' from 'bitrix24'

ImportError: cannot import name 'Bitrix24' from 'bitrix24'

我使用 pip

安装了这个模块 https://github.com/gebvlad/bitrix24-python-sdk
python3.8 -m pip install -I bitrix24-python-sdk

当我尝试导入这个模块时

from bitrix24 import Bitrix24

我收到下一个错误

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/vinni/Documents/GitHub/funnel.py", line 2, in <module>
    from bitrix24 import Bitrix24
ImportError: cannot import name 'Bitrix24' from 'bitrix24' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bitrix24/__init__.py)

OS - MacOS 10.15 Python - 3.8

我运行遇到了同样的问题,我用

解决了

from bitrix24.bitrix24 import Bitrix24

简单来说,我查看了Python的modules-directory。

from bitrix24 正在导航到目录, .bitrix24是指这个目录里面的bitrix24.py文件,import Bitrix24是指这个文件里面的class。

希望这也能帮助您日后发现模块错误!