python引入requests模块报错
胜博发娱乐手机版
胜博发娱乐手机版
当前位置 : 胜博发娱乐手机版 > 胜博发娱乐手机版

python引入requests模块报错

import requests模块总是报错,求助大神

>>> import requests
Traceback most recent call last:
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 68, in <module>
    _attach_namespaceurllib3, requests.packages
  File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 61, in _attach_namespace
    package.__name__ + .:
  File "/usr/lib/python2.7/pkgutil.py", line 105, in walk_packages
    for importer, name, ispkg in iter_modulespath, prefix:
  File "/usr/lib/python2.7/pkgutil.py", line 147, in iter_modules
    for name, ispkg in iter_importer_modulesi, prefix:
  File "/usr/lib/python2.7/pkgutil.py", line 196, in iter_modules
    import inspect
  File "/usr/lib/python2.7/inspect.py", line 39, in <module>
    import tokenize
  File "/usr/lib/python2.7/tokenize.py", line 39, in <module>
    COMMENT = N_TOKENS
NameError: name N_TOKENS is not defined

在其他系统上都不存在这样的问题, 求助各位!!

是不是当前目录下有个重名的token.py文件

重装requests

结论:需要重装
原因:从报错来看,是有一个对象没有定义,具体为什么报错not defined,需要看源码,那还是的重装

广告位

胜博发娱乐手机版