当我尝试执行此代码时,
from linkedin import linkedin
from oauthlib import *
authentication = linkedin.LinkedInDeveloperAuthentication(CONSUMER_KEY,
CONSUMER_SECRET,
USER_TOKEN, USER_SECRET,
RETURN_URL,
linkedin.PERMISSIONS.enums.values())
# Pass it in to the app...
application = linkedin.LinkedInApplication(authentication)
# Use the app....
g = application.get_profile()
print g
我收到此错误。
ImportError Traceback (most recent call last)
<ipython-input-24-ec5bf07a1f1d> in <module>()
6 RETURN_URL = 'http://localhost:8000'
7
----> 8 from linkedin import linkedin
9 from oauthlib import *
10
ImportError: cannot import name linkedin
但我安装了所有这些库 -
linkedin,python-linkedin,requests,oauthlib
即使我安装了所有库,为什么会出现此错误?
答案 0 :(得分:2)
您与两个linkedin库存在冲突。
两者都使用您的import linkedin
语句调用。
为了使它能够工作,您应该使用pip卸载linkedin一个,在LinkedIn中的LinkedInDeveloperAuthentication对象。
pip uninstall linkedin