简体   繁体   中英

Python fails to import SharePlum, even though it is installed correctly

Trying to use SharePlum, but getting this error when importing:-

>>> from shareplum import Office365
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/myac/.local/lib/python2.7/site-packages/shareplum/__init__.py", line 5, in <module>
    from .office365 import Office365  # noqa: F401
  File "/home/myac/.local/lib/python2.7/site-packages/shareplum/office365.py", line 6, in <module>
    from .request_helper import post
  File "/home/myac/.local/lib/python2.7/site-packages/shareplum/request_helper.py", line 2, in <module>
    from .errors import ShareplumRequestError
  File "/home/myac/.local/lib/python2.7/site-packages/shareplum/errors.py", line 4
    super().__init__(f"{msg} : {details}")

I've installed shareplum, requests, requests-ntlm, requests-toolbelt, and lxml but I keep getting this error.

Any clues?

The Shareplum version that you've installed has been configured on your python 2.7 interpreter(this is your default python version), though the version is 0.5.1, which is not supported on Python2.7: https://pypi.org/project/SharePlum/0.5.1/

Either you downgrade you Shareplum version to the one which is compatible with python2.7 ie https://pypi.org/project/SharePlum/0.3.0/

pip install shareplum==0.3.0

or

Make use of Python3 and install latest shareplum for that:

pip3 install shareplum

And when running terminal or the script, please make use of python3 binary instead of python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM