简体   繁体   English

VSCode ImportError:没有名为web3的模块

[英]VSCode ImportError: No module named web3

I have Python3 and Python2 in my ubuntu 16.04. 我的Ubuntu 16.04中有Python3和Python2。 naturally, I install pip3 and pip. 自然,我安装了pip3和pip。 But When I use VScode to run my python3 code, it can't find my package! 但是,当我使用VScode运行我的python3代码时,它找不到我的包! I don't find where to set the package path. 我找不到在哪里设置包路径。 I need help, thanks! 我需要帮助,谢谢!

[Running] python "source/pyweb3.py"
Traceback (most recent call last):
  File "source/pyweb3.py", line 5, in <module>
    import web3
ImportError: No module named web3

[Done] exited with code=1 in 0.059 seconds

Here are the package information of my pip and pip3 : 这是我的pip和pip3的软件包信息:

ubuntu:/source$ pip list
Package                       Version
----------------------------- ----------------------
                  …
virtualenv                    15.2.0
Werkzeug                      0.14.1
wheel                         0.29.0
wrapt                         1.10.11
                  …

ubuntu:/source$ pip3 list
Package                       Version
----------------------------- ----------------------
                  …
virtualenv                    15.2.0
web3                          4.2.1
websockets                    4.0.1
                  …

Here are the information of my pip and pip3 : 这是我的pip和pip3的信息:

ubuntu:/source$ pip3 --version
pip 10.0.1 from /home/username/.local/lib/python3.5/site-packages/pip (python 3.5)

ubuntu:/source$ pip --version
pip 10.0.1 from /home/username/.local/lib/python2.7/site-packages/pip (python 2.7)

OK, it's the problem of the extension: Python. 好的,这是扩展的问题:Python。 Just press F1 and input: select Interpreter to switch Python3, the problem is fixed. 只需按F1并输入:选择解释器即可切换Python3,此问题已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM