Python 3.6 |导入包“tweepy”时出错

时间:2018-02-07 00:30:50

标签: package anaconda python-import spyder tweepy

在python 3.6 中导入包tweepy时出现

运行时错误

我正在尝试在Windows 10上运行的Pyhton 3.6上安装和导入包Tweepy。 使用Anaconda Prompt我成功地能够安装包“tweepy”,但是当我打开Spyder导入相同的包时,我面临以下运行时错误:

File "C:\Users\mohit\Anaconda3\lib\imp.py", line 271, in find_module

    "not {}".format(type(path))) RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

非常感谢任何可能导致此错误的原因的帮助,提前致谢!

详细

使用Anaconda Prompt安装“tweepy”后的结果:

(C:\Users\mohit\Anaconda3) C:\Users\mohit>pip install -U tweepy
Requirement already up-to-date: tweepy in c:\users\mohit\anaconda3\lib\site-packages
Requirement already up-to-date: six>=1.7.3 in c:\users\mohit\anaconda3\lib\site-packages (from tweepy)
Requirement already up-to-date: requests>=2.4.3 in c:\users\mohit\anaconda3\lib\site-packages (from tweepy)
Requirement already up-to-date: requests-oauthlib>=0.4.1 in c:\users\mohit\anaconda3\lib\site-packages (from tweepy)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in c:\users\mohit\anaconda3\lib\site-packages (from requests>=2.4.3->tweepy)
Requirement already up-to-date: idna<2.7,>=2.5 in c:\users\mohit\anaconda3\lib\site-packages (from requests>=2.4.3->tweepy)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in c:\users\mohit\anaconda3\lib\site-packages (from requests>=2.4.3->tweepy)
Requirement already up-to-date: certifi>=2017.4.17 in c:\users\mohit\anaconda3\lib\site-packages (from requests>=2.4.3->tweepy)
Requirement already up-to-date: oauthlib>=0.6.2 in c:\users\mohit\anaconda3\lib\site-packages (from requests-oauthlib>=0.4.1->tweepy)
在spyder控制台上运行命令import tweepy后出现

错误:

  

导入tweepy

Traceback (most recent call last):

  File "<ipython-input-5-9d8dd8a91c0e>", line 1, in <module>
    import tweepy

  File "C:\Users\mohit\Anaconda3\lib\site-packages\tweepy\__init__.py", line 16, in <module>
    from tweepy.auth import OAuthHandler, AppAuthHandler

  File "C:\Users\mohit\Anaconda3\lib\site-packages\tweepy\auth.py", line 9, in <module>
    from requests_oauthlib import OAuth1Session, OAuth1

  File "C:\Users\mohit\Anaconda3\lib\site-packages\requests_oauthlib\__init__.py", line 3, in <module>
    from .oauth2_auth import OAuth2

  File "C:\Users\mohit\Anaconda3\lib\site-packages\requests_oauthlib\oauth2_auth.py", line 2, in <module>
    from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError

  File "C:\Users\mohit\Anaconda3\lib\site-packages\oauthlib\oauth2\__init__.py", line 11, in <module>
    from .rfc6749.clients import Client

  File "C:\Users\mohit\Anaconda3\lib\site-packages\oauthlib\oauth2\rfc6749\clients\__init__.py", line 11, in <module>
    from .base import Client, AUTH_HEADER, URI_QUERY, BODY

  File "C:\Users\mohit\Anaconda3\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 17, in <module>
    from oauthlib.oauth2.rfc6749.parameters import (parse_token_response,

  File "C:\Users\mohit\Anaconda3\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 17, in <module>
    from oauthlib.signals import scope_changed

  File "C:\Users\mohit\Anaconda3\lib\site-packages\oauthlib\signals.py", line 9, in <module>
    from blinker import Namespace

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load

  File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 890, in _find_spec

  File "<frozen importlib._bootstrap>", line 864, in _find_spec_legacy

  File "C:\Users\mohit\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 253, in find_module
    fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

  File "C:\Users\mohit\Anaconda3\lib\imp.py", line 271, in find_module
    "not {}".format(type(path)))

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
'

操作系统:Windows 10,64位 蟒蛇3 Python版本:3.6

1 个答案:

答案 0 :(得分:0)

Spyder维护者)这是Spyder中已知的bug。在我们修复它之前,请阅读与其相关的线程以获得临时解决方法。