How to save custom preferences of python#39;s IDLE?(如何保存python IDLE的自定义首选项?)
问题描述
我在不同位置有几台计算机,虽然我没有在 IDLE 中编码,但它始终在后台运行,用于小型测试、调试和研究任务.我在家里配置了 IDLE 自定义高亮、键集等,将我的设置保存到外部文件中,并将这些设置安装到我正在使用的任何机器上会很舒服.
I have several computers at different locations, and although I'm not coding in IDLE, it is always running in the background, for small testing, debugging and researching tasks. I configured IDLE custom highlighting, key set, etc. at home, and it would be pretty comfy to save my settings into an external file, and install these settings onto any machines I'm working on.
所以我的问题是:有没有办法做到这一点?
So my question: is there a way to do that?
或者,如果有人知道 IDLE 将这些数据存储在哪里,那就太好了——也许我可以从那里复制文件..
Or it would be also nice, if anyone knows where IDLE stores these datas — probably I can copy the file(s) from there..
提前致谢!
推荐答案
IDLE 将其首选项保存在 $HOME/.idlerc
目录下的多个文件中,创建文件(例如,config-main.cfg
) 根据需要.至少重要的是简单的文本文件,因此您应该能够将这些文件从一台机器上的主目录复制到另一台机器上.有一些潜在的问题需要注意:
IDLE saves its preferences in several files in the $HOME/.idlerc
directory, creating the files (for example, config-main.cfg
) as needed. The important ones, at least, are simple text files so you should be able to copy those files from your home directory on one machine to another. There are a few potential gotcha's to watch out for:
将文件复制到另一个主目录时,请确保没有 IDLE实例正在运行.
When you copy the files to another home directory, make sure no IDLE instances are running.
请注意,目前所有版本的 IDLE(使用 Python 2.7、3.2、3.3 等)共享相同的 .idlerc
目录和文件.我目前不知道有任何重大冲突,可能是最近的冲突文件名包含需要 Unicode 的非 ASCII 字符的文件表示:这可能会导致 IDLE 2.x 和 3.x 之间的共享问题.
Be aware that currently all versions of IDLE (with Python 2.7, 3.2,
3.3, etc) share the same .idlerc
directory and files. I'm not aware of any major conflicts at this point other than possibly recent
files with file names with non-ASCII characters that require Unicode
representation: that could cause problems sharing between IDLE 2.x and 3.x.
如果您尝试共享文件,另一个问题可能是行尾在 Windows 和非 Windows 系统之间.
Another issue might be line endings if you attempt to share files between Windows and non-Windows systems.
这篇关于如何保存python IDLE的自定义首选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何保存python IDLE的自定义首选项?
基础教程推荐
- 筛选NumPy数组 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01