Python3:AttributeError: ‘_NamespacePath‘ object has no attribute ‘sort‘

                  AttributeError: '_NamespacePath' object has no attribute 'sort'

python3.6安装locust时,导致pip包出问题,出现报错 AttributeError: '_NamespacePath' object has no attribute 'sort'

解决办法:按如下编辑报错文件大概 #2121行

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources

#orig_path.sort(key=position_in_sys_path)
#module.__path__[:] = [_normalize_cached(p) for p in orig_path]
orig_path_t = list(orig_path)
orig_path_t.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]

参考:

https://stackoverflow.com/questions/48775321/python3-pip3-attributeerror-namespacepath-object-has-no-attribute-sort

https://stackoverflow.com/questions/47955397/pip3-error-namespacepath-object-has-no-attribute-sort#

 

你可能感兴趣的:(#,Python,python,pip)