【问题标题】:Import error - Linkedin API导入错误 - Linkedin API
【发布时间】:2017-08-22 19:01:05
【问题描述】:

当我试图执行这段代码时,

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

为什么即使我已经安装了所有库,我也会收到此错误?

【问题讨论】:

    标签: python linkedin-api


    【解决方案1】:

    您的两个linkedin 库有冲突。 两者都使用您的 import linkedin 语句调用。

    为了让它工作,你应该卸载linkedin,LinkedInDeveloperAuthentication对象在python-linkedin中使用pip。

    pip uninstall linkedin
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-25
      • 2015-02-02
      • 2017-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多