这个问题的原因是readline 包的问题,可以重新编译,替换
下载python3.4源码
https://www.python.org/ftp/python/3.4.0/
解压进入到源码包中vi setup.py
找到代码:
add_dir_to_list(self.compiler.library_dirs, ‘/usr/local/lib‘) add_dir_to_list(self.compiler.include_dirs, ‘/usr/local/include‘
在该行代码前面加入两行代码 python包目录
add_dir_to_list(self.compiler.library_dirs, ‘/opt/local/lib‘) add_dir_to_list(self.compiler.include_dirs, ‘/opt/local/include‘) add_dir_to_list(self.compiler.library_dirs, ‘/usr/local/lib‘) add_dir_to_list(self.compiler.include_dirs, ‘/usr/local/include‘)
执行
./configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.5 --with-universal-archs=all $ make
将重新编译后的readline.so文件拷贝到
cp readline.so /System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/
关闭命令窗口重新打开 输入python命令 测试
时间: 2024-10-08 06:11:28