解决Python出现_warn_unsafe_extraction问题的方法

yipeiwu_com5年前Python基础

在Python项目中运行出现了“AttributeError: ResourceManager instance has no attribute ‘_warn_unsafe_extraction'”问题,研究了一下,发现是setuptools在MacOS下的一个问题(见下图),我出现问题的是pymongo的库,需要删除pymongo,然后降级setuptools再重新安装。

解决方法:

1、删除pymongo:

sudo easy_install -mxN pmongo

2、降级setuptools:

sudo easy_install -mxN setuptools
sudo easy_install "setuptools<0.7"

3、重装pymongo:

sudo easy_install pymongo

问题解决!!!!!

附错误信息:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /Users/yourtion/Codes/python/knowme/server.py
Traceback (most recent call last):
 File "/Users/yourtion/Codes/python/knowme/server.py", line 5, in <module>
 from Handler.api import UserHandler
 File "/Users/yourtion/Codes/python/knowme/Handler/api.py", line 3, in <module>
 from Model.user import User
 File "/Users/yourtion/Codes/python/knowme/Model/user.py", line 2, in <module>
 from mongoengine import *
 File "build/bdist.macosx-10.9-intel/egg/mongoengine/__init__.py", line 1, in <module>
 File "build/bdist.macosx-10.9-intel/egg/mongoengine/document.py", line 4, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/__init__.py", line 80, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/connection.py", line 39, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/pymongo/mongo_client.py", line 44, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/__init__.py", line 41, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/_cbson.py", line 7, in <module>
 File "/Library/Python/2.7/site-packages/pymongo-2.6.3-py2.7-macosx-10.8-intel.egg/bson/_cbson.py", line 4, in __bootstrap__
 File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 914, in resource_filename
 %s
 File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 1601, in get_resource_filename
 """Retrieve a PEP 302 "importer" for the given path item
 File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 1629, in _extract_resource
 from pkgutil import get_importer, ImpImporter
 File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 990, in get_cache_path

AttributeError: ResourceManager instance has no attribute '_warn_unsafe_extraction'

Process finished with exit code 1

原文链接:http://blog.yourtion.com/solve-warn_unsafe_extraction.html

相关文章

Python学习笔记之变量、自定义函数用法示例

本文实例讲述了Python变量、自定义函数用法。分享给大家供大家参考,具体如下: 不管你学什么编程语言 都逃不出如下套路: 1、怎么定义变量?是否有数据类型,怎么在控制台输出? 2、怎...

python常用函数与用法示例

本文实例讲述了python常用函数与用法。分享给大家供大家参考,具体如下: 自定义函数实例 # 定义一个函数 def printme( str ): "打印任何传入的字符串"...

利用selenium 3.7和python3添加cookie模拟登陆的实现

利用selenium 3.7和python3添加cookie模拟登陆的实现

前言 随着Python3的普及,Selenium3也跟上了行程。而Selenium3最大的变化是去掉了Selenium RC,另外就是Webdriver从各自浏览器中脱离,必须单独下载。...

python 魔法函数实例及解析

python的几个魔法函数 __repr__ Python中这个__repr__函数,对应repr(object)这个函数,返回一个可以用来表示对象的可打印字符串.如果我们直接打印...

基于DATAFRAME中元素的读取与修改方法

DATAFRAME中使用iat[1,0]和iloc[0,1]对元素进行修改。 a = [("hahaha",1),("lalala",2),("cacaca",6)] b = pad...