简体   繁体   中英

Python Office 365 rest API module not found

I want to extract some data from sharepoint. However, it was recommended on stack overflow one of the posts to use office 365 rest api ( Python - Download files from SharePoint site ). I have installed the office 365 rest api module in the anaconda environment and running the code via jupyter notebook. However, whenever I am importing the module, it still shows that the module not found.

import pkg_resources

dists = [str(d) for d in pkg_resources.working_set]
dists = [d for d in dists if 'office365' in d]
dists

['office365 0.3.15']

The above shows that I have office 365 installed. However, when I import it.

import office365

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-6a2920e48d42> in <module>
----> 1 import office365

ModuleNotFoundError: No module named 'office365'

Can someone please help me with how to fix this?

Thanks,

I was having similar problems, when I tried pip install office365-rest-client instead of pip install office365 it all worked fine. :)

Please don't use pip and conda in competition from each other. If you're going to install a PyPi package, I'd recommend following conda's documentation on building a PyPi package into something compatible with conda using conda skeleton . It will keep your conda environments from conflicting on your machine.

I'd do the following:

conda skeleton pypi Office365-REST-Python-Client

This above tells skeleton to look to the PyPi resource for your package.

conda-build Office365-REST-Python-Client

This above will build the package, you may have dependencies you'll need to install with conda. After you resolve those dependencies you'll use the below to install the locally built package into your conda environment.

conda install --use-local Office365-REST-Python-Client

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