在OSX上更新Python和包
我正在尝试在运行Mavericks的Apple机器上更新python安装。我担心我用自制的东西弄糟了 当我尝试使用tab complete在OSX上更新Python和包,python,macos,numpy,pip,updates,Python,Macos,Numpy,Pip,Updates,我正在尝试在运行Mavericks的Apple机器上更新python安装。我担心我用自制的东西弄糟了 当我尝试使用tab completepython时,我得到以下输出: python python2.5-config python2.7 python3-config pythonw pythonw2.7 python-config python2.6 python2.7-config python3.3
python
时,我得到以下输出:
python python2.5-config python2.7 python3-config pythonw pythonw2.7
python-config python2.6 python2.7-config python3.3 pythonw2.5 pythonw3.3
python2.5 python2.6-config python3 python3.3-config pythonw2.6
尝试通过PyCharm更新numpy会导致以下错误:
Upgrade packages failed.
The following command was executed:
/Applications/PyCharm CE.app/helpers/packaging_tool.py install --build-dir /private/var/folders/7r/9rtxb7c94bv_k4szp8lnkpmm0000gn/T/pycharm-packaging258144586042338380.tmp -U numpy
The error output of the command:
Storing debug log for failure in /Users/myusername/Library/Logs/pip.log (1)
升级包失败。
已执行以下命令:
/Applications/PyCharm CE.app/helpers/packaging_tool.py安装——build dir/private/var/folders/7r/9rtxb7c94bv_k4szp8lnkpmm0000gn/T/PyCharm-packaging258144586042338380.tmp-U numpy
命令的错误输出:
在/Users/myusername/Library/Logs/pip.log(1)中存储故障调试日志
检查日志文件,似乎这就是导致故障的原因
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
failure.
叮当声:错误:未知参数:'-mno fused madd'[-Wunused命令行参数将来出现硬错误]
叮当声:注意:这将是一个硬错误(不能降级为警告)在未来
叮当声:错误:未知参数:'-mno fused madd'[-Wunused命令行参数将来出现硬错误]
叮当声:注意:这将是一个硬错误(不能降级为警告)在未来
失败。
当我运行sudopip安装-U numpy时,我得到了与上面相同的错误
基于这些信息,我(希望是正确的)得出结论,我正在尝试更新苹果提供的python,MacPorts可能更适合解决这项任务。我安装了MacPorts并运行了过时的端口升级
,这导致无需升级
如何从2.7.5更新到2.7.6并更新相关的包?问题在于,小牛似乎已经打破了构建python扩展的过程。mavericks上的python是使用带有旧选项的旧编译器构建的。这些选项存储在中以供以后使用
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
您可以手动编辑此文件以删除错误的编译器选项,也可以让sed为您执行以下操作:
sed -i 's/-mno-fused-madd//' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
我只在Python2.7系统上测试和使用过这个。我不知道在您的/usr/localpython版本上是否也可以使用相同的方法。使用自制或其他工具来使用最新的编译器选项重建这些python实例可能会更容易
更新:您可能还更喜欢使用gcc而不是clang。请参阅:您至少应该得到一个不同的错误。如果您没有得到不同的错误,那么您对-mno-fused-madd的删除不起作用。您一定编辑了错误的文件或运行了错误的python。我最终重新安装了Mavericks。我知道这对其他可能有这个问题的人没有帮助,但现在一切都正常了。我认为问题在于OSX提供的python不需要手动更新(这正是我试图做的)。
Upgrade packages failed.
The following command was executed:
/Applications/PyCharm CE.app/helpers/packaging_tool.py install --build-dir /private/var/folders/7r/9rtxb7c94bv_k4szp8lnkpmm0000gn/T/pycharm-packaging258144586042338380.tmp -U numpy
The error output of the command:
Storing debug log for failure in /Users/myusername/Library/Logs/pip.log (1)
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
failure.
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
sed -i 's/-mno-fused-madd//' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py