当前位置:  开发笔记 > 编程语言 > 正文

如何解决'module'对象没有属性'_base'问题?

如何解决《如何解决'module'对象没有属性'_base'问题?》经验,为你挑选了1个好方法。

我正在尝试运行位于此处的investopedia api:https://github.com/kirkthaker/investopedia-trading-api

我写了以下脚本:

from investopedia import *
client = Account("emailaddress","password")

status = client.get_portfolio_status()
print status.account_val
print status.buying_power
print status.cash
print status.annual_return

我能够通过运行py -2.7 setup.py install每个依赖项来安装所有模块.

我收到以下错误:

Traceback (most recent call last):
File "C:/Users/Z/PycharmProjects/investopedia/test.py", line 1, in 
    from investopedia import *
  File "C:\Users\Z\PycharmProjects\investopedia\investopedia.py", line 4, in 
    from bs4 import BeautifulSoup
  File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\__init__.py", line 29, in 
    from .builder import builder_registry
  File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\__init__.py", line 297, in 
    from . import _html5lib
  File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\_html5lib.py", line 57, in 
    class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'

你知道怎么解决这个问题吗?



1> hasanzuav..:

通过使用解决了这个问题

pip2.7 install --upgrade beautifulsoup4
pip2.7 install --upgrade html5lib

现在工作得很漂亮.

推荐阅读
贴进你的心聆听你的世界
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有