简体   繁体   中英

ModuleNotFoundError: No module named 'web3' on jupyter notebook

I am trying to run the following code in Jupyter Notebook using Anaconda (I used pip to install web3):

from web3 import Web3
w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
w3=util.connect(host="172.18.0.8",port="8545",poa=True)
assert w3.isConnected()

However, I get this Error Stack:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-10-0c63a16e1a59> in <module>
----> 1 from web3 import Web3
      2 
      3 w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
      4 w3=util.connect(host="172.18.0.8",port="8545",poa=True)
      5 assert w3.isConnected()

ModuleNotFoundError: No module named 'web3'

Anyone knows how to resolve this?

Okay, so I managed to find the answer myself with the help of @NicolaLandro: I did not use the command in the notebook. However it worked, when I tried pip install web3 inside the conda prompt, after activating conda environment. Thanks a lot!

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