python six模块升级方法

在Mac OS X中,由于默认Python安装为框架且Extras目录中已包含six包,导致无法直接使用pip升级。根据MacPython的描述,Extras目录在模块搜索路径中优先于site-packages,所以已存在的包无法升级。解决方案是使用easy_install代替pip进行升级,即使pip失败,easy_install也能成功升级six包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

github地址

Mac OS X’s default python is installed as a framework. Under the framework directory, there is an ‘Extras’ directory and six package is already placed there.

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py

According to the description
(https://github.com/MacPython/wiki/wiki/Which-Python), /System/Library/Frameworks/Python.framework/Versions/2.7/Extras is listed before /Library/Python/2.7/site-packages in module search path. This means all packages already exists in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras can’t upgrade.

也许是由于这个原因,没法直接用Pip升级

解决方法:
What worked for me was to use easy_install instead of pip.

easy_install -U six
Easy_install managed to upgrade the package even when pip failed.

来自:

https://stackoverflow.com/questions/29485741/unable-to-upgrade-python-six-package-in-mac-osx-10-10-2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值