我正在尝试运行位于此处的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 <module>
from investopedia import *
File "C:\Users\Z\PycharmProjects\investopedia\investopedia.py", line 4, in <module>
from bs4 import BeautifulSoup
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\__init__.py", line 29, in <module>
from .builder import builder_registry
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\__init__.py", line 297, in <module>
from . import _html5lib
File "C:\Users\Z\AppData\Local\Enthought\Canopy\User\lib\site-packages\bs4\builder\_html5lib.py", line 57, in <module>
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'
你知道如何解决这个问题吗?
答案 0 :(得分:22)
使用
解决了这个问题pip2.7 install --upgrade beautifulsoup4
pip2.7 install --upgrade html5lib
现在工作得非常好。
答案 1 :(得分:0)
使用conda
解决了这个问题conda install beautifulsoup4
conda install html5lib