我知道这个问题在这个网站上被问了很多,但我已经尝试了所有给出的解决方案,我不知道如何解决这个问题。在
首先:我在Windows 10
计算机上使用Python 3.6
。我安装了Anaconda
作为我的IDE。在
我试图用pip
安装BeautifulSoup4
,但是我得到了
Requirement already satisfied
回应。在
我要运行的代码只是
from bs4 import BeautifulSoup4
to which I get the error: ImportError: cannot import name 'BeautifulSoup4'
The full error is:
runfile('C:/Users/ter/.spyder-py3/untitled1.py', wdir='C:/Users/ter/.spyder-py3')
Traceback (most recent call last):
File "<ipython-input-21-8717178e85e1>", line 1, in <module>
runfile('C:/Users/ter/.spyder-py3/untitled1.py', wdir='C:/Users/ter/.spyder-py3')
File "C:\Users\ter\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "C:\Users\ter\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/ter/.spyder-py3/untitled1.py", line 8, in <module>
from bs4 import BeautifulSoup4
ImportError: cannot import name 'BeautifulSoup4'
以下是我试图解决的问题:
bs4
(importbs4
)。这样做非常好,或者至少不会导致任何错误。在bs4
文件当前位于默认的Anaconda
文件夹中。然后我将CD更改为项目文件的位置,甚至尝试将bs4
、bs4-0.0.1.dist-info
和{pip3
安装bs4
。我不知道有没有必要,但我也这么做了。在Anaconda
一次和{无论如何,我希望这有助于描述问题。如果我能提供更多的信息,请告诉我。在
提前谢谢你们能给我的任何帮助!在
正如@Blender所提到的那样,BeautifulSoup:
输出
^{pr2}$上面的代码是从这个question中获取的示例
相关问题 更多 >
编程相关推荐