pip freeze output:
aiohttp==3.8.1
aiosignal==1.2.0
alembic==1.7.5
aniso8601==9.0.1
async-timeout==4.0.1
attrs==21.2.0
base58==2.1.1
bitarray==1.2.2
certifi==2021.10.8
charset-normalizer==2.0.7
click==8.0.3
cytoolz==0.11.2
eth-abi==2.1.1
eth-account==0.5.6
eth-hash==0.3.2
eth-keyfile==0.5.1
eth-keys==0.3.3
eth-rlp==0.2.1
eth-typing==2.2.2
eth-utils==1.10.0
Flask==2.0.2
flask-marshmallow==0.14.0
Flask-Migrate==3.1.0
Flask-RESTful==0.3.9
Flask-Script==2.0.6
Flask-SQLAlchemy==2.5.1
frozenlist==1.2.0
hexbytes==0.2.2
idna==3.3
ipfshttpclient==0.8.0a2
itsdangerous==2.0.1
Jinja2==3.0.3
jsonschema==3.2.0
lru-dict==1.1.7
Mako==1.1.6
MarkupSafe==2.0.1
marshmallow==3.14.1
marshmallow-sqlalchemy==0.26.1
multiaddr==0.0.9
multidict==5.2.0
netaddr==0.8.0
parsimonious==0.8.1
protobuf==3.19.1
psycopg2==2.9.2
pycryptodome==3.11.0
pyrsistent==0.18.0
pytz==2021.3
requests==2.26.0
rlp==2.0.1
six==1.16.0
SQLAlchemy==1.4.27
toolz==0.11.2
typing_extensions==4.0.0
urllib3==1.26.7
varint==1.0.2
web3==5.25.0
websockets==9.1
Werkzeug==2.0.2
yarl==1.7.2python版本: 3.10.0
我使用venv中命令的pip install web3安装web3
为了创建我的venv,我做了-p python3 venv,所以我不认为虚拟环境有问题。
但是,当我在我的test.py中执行以下操作时:从web3导入Web3
我得到一个回溯错误,没有名为"web3“的模块
发布于 2021-11-22 00:29:16
在运行test.py之前,你是否在采购你的venv?
如果是这样,那么试试这个:
source venv/bin/activate
pip uninstall web3==5.25.0
pip install web3==5.25.0
python test.py(因为你的pip冻结是正确的),也试试这个
which python这将为您提供当前正在由您的shell使用的python bin。(检查您得到的路径是否为venv路径)。
https://stackoverflow.com/questions/70059478
复制相似问题