python 中出現的AttributeError: 'module' object has no attribute '_handlerList'


Traceback (most recent call last):

  File "/usr/local/bin/pip", line 9, in <module>

    load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()

  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 233, in main

    return command.main(cmd_args)

  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 185, in main

    for name in ["pip._vendor", "distlib", "requests", "urllib3"]

  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/compat/dictconfig.py", line 565, in dictConfig

    dictConfigClass(config).configure()

  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/compat/dictconfig.py", line 332, in configure

    del logging._handlerList[:]

AttributeError: 'module' object has no attribute '_handlerList'

 

一.pip 版本升級造成的原因

升級過后會有 logging-0.4.9.6的在你的/Library/Python/2.7/site-packages/文件夾下的,刪除即可。

 

二.easy_install 的logging文件

若是前面第一步完成后還沒有解決,繼續查看下一步即可,親

logging文件也是在/Library/Python/2.7/site-packages/文件夾下

 

 

@Aarushi-Ign You shouldn't have any logging-0.4.9.6, or easy_install logging. The logging module is part of the standard library. What seems to be happening is that your 3rd-party logging module is overriding the stdlib version (that's a fault of easy_install, which puts 3rd party modules ahead of the standard library in PYTHONPATH).

Try uninstalling all 3rd party logging modules, and that should fix your issue.

 

這是翻牆看到的解決方案。

鏈接:https://github.com/pypa/pip/issues/3193

 

若是你還有其他更好解決的方法,或者疑問,請留言。謝謝親

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM