I already installed web3 using pip install, but I get the error "ImportError: No module named web3" when I try to use it.
Without your source code, it's hard to say exactly what's going wrong. However, you might have mismatched
python if your environment already has Python 2 installed and you're attempting to use Python 3.
pip install web3 and then create a file with the following contents:
import json import web3 from web3 import Web3, HTTPProvider, TestRPCProvider
I don't have any problems with it on macOS with Python 3:
$ pip --version pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6) $ python --version Python 3.6.4
You might consider looking into virtualenv so that you can have a clean Python environment each time you want to work with it. This can also help ensure you have isolation between Python versions and pip installs.