简体   繁体   中英

jupyter notebook in VS code: Why can I not load library 'requests'?

It worked...

Im on mac OS 10.15.7 and I have a function in a python script that needs the requests module. I followed the installation outlined here by user TheoretiCAL .

Last week I ran the script successfully from the VS code interpreter using python3.9.1 .

...until it didn't:

Today I had to import requests in jupyter still in VS code. The module is not found despite VS being set to

  • python3.9.1 in the lower left corner
  • pip --version giving me:

pip 21.1.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)

  • import sys print(sys.version) giving me 3.9.1
  • Also jupyter is running the right kernel as seen in the top right corner of VS (screenshot at the bottom of the page)

Unfortunately this did not help me any further either.

From my side it looks like I've done everything that is recommended. What did my tiny beginners brain miss?

在此处输入图像描述

在此处输入图像描述

Thank you for your help

  1. After selecting interpreter, you may install the module in current environment;

  2. Choose the same environment for Jupyter;

  3. Use pip show requests to check its location. If not in current selected environment, enter the environment and reinstall it.

在此处输入图像描述

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