Visual Studio代码Python imp

2024-06-16 11:17:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试一个简单的应用程序。但是,我无法从导入BS4与代码. 我尝试过卸载,重新安装,检查路径等,我现在卡住了。有人知道如何解决这个问题吗?请看截图:

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\workarea\dev\test> & c:/APPS/Python35-32/python.exe c:/workarea/dev/test/bs4.py
Traceback (most recent call last):
  File "c:/workarea/dev/test/bs4.py", line 5, in <module>
    from bs4 import BeautifulSoup
  File "c:\workarea\dev\test\bs4.py", line 5, in <module>
    from bs4 import BeautifulSoup
ImportError: cannot import name 'BeautifulSoup'
PS C:\workarea\dev\test> & c:/APPS/Python35-32/python.exe c:/workarea/dev/test/hello.py
['c:\\workarea\\dev\\test', 'C:\\APPS\\Python35-32\\python35.zip', 'C:\\APPS\\Python35-32\\DLLs', 'C:\\APPS\\Pytho
n35-32\\lib', 'C:\\APPS\\Python35-32', 'C:\\APPS\\Python35-32\\lib\\site-packages']

从VS代码导入无效,但从命令行可以正常工作。


Tags: apps代码inpydevtestimportline