Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 已安装BeautifulSoup,但仍存在miniconda抛出属性错误_Python_Beautifulsoup_Python 3.4_Anaconda - Fatal编程技术网

Python 已安装BeautifulSoup,但仍存在miniconda抛出属性错误

Python 已安装BeautifulSoup,但仍存在miniconda抛出属性错误,python,beautifulsoup,python-3.4,anaconda,Python,Beautifulsoup,Python 3.4,Anaconda,我有一个小脚本(bot.py)来抓取链接,它使用带urllib的BeautifulSoup(python 3.4) 当我在Miniconda中运行它时,我得到以下错误: Traceback (most recent call last): File "StanBot.py", line 17, in <module> soup = BeautifulSoup.BeautifulSoup(html) AttributeError: type object 'Beautifu

我有一个小脚本(bot.py)来抓取链接,它使用带urllib的BeautifulSoup(python 3.4)

当我在Miniconda中运行它时,我得到以下错误:

Traceback (most recent call last):
  File "StanBot.py", line 17, in <module>
    soup = BeautifulSoup.BeautifulSoup(html)
AttributeError: type object 'BeautifulSoup' has no attribute 'BeautifulSoup'
回溯(最近一次呼叫最后一次):
文件“StanBot.py”,第17行,在
soup=BeautifulSoup.BeautifulSoup(html)
AttributeError:类型对象“BeautifulSoup”没有属性“BeautifulSoup”
但miniconda中已经安装了BeautifulSoup:

[py34] C:\Users\Anna\Desktop>conda list
# packages in environment at C:\Miniconda3\envs\py34:
#
beautiful-soup            4.3.2                    py34_1
beautifulsoup4            4.3.2                     <pip>
msvc_runtime              1.0.1                    vc10_0  [vc10]
pip                       7.1.2                    py34_0
python                    3.4.3                         4
setuptools                18.5                     py34_0
wheel                     0.26.0                   py34_1

[py34] C:\Users\Anna\Desktop>
[py34]C:\Users\Anna\Desktop>conda列表
#位于C:\Miniconda3\envs\py34的环境中的包:
#
靓汤4.3.2 py34_1
第4.3.2条
msvc_运行时1.0.1 vc10_0[vc10]
pip 7.1.2 py34_0
python 3.4.3.4
setuptools 18.5 py34_0
车轮0.26.0 py34_1
[py34]C:\Users\Anna\Desktop>

我找了很多,但找不到合适的解决办法。什么原因导致这种情况?

试着用
soup=BeautifulSoup(html)
代替
BeautifulSoup.BeautifulSoup(html)
试着用
BeautifulSoup(html)
[py34] C:\Users\Anna\Desktop>conda list
# packages in environment at C:\Miniconda3\envs\py34:
#
beautiful-soup            4.3.2                    py34_1
beautifulsoup4            4.3.2                     <pip>
msvc_runtime              1.0.1                    vc10_0  [vc10]
pip                       7.1.2                    py34_0
python                    3.4.3                         4
setuptools                18.5                     py34_0
wheel                     0.26.0                   py34_1

[py34] C:\Users\Anna\Desktop>