简体   繁体   English

如何保存python的IDLE的自定义首选项?

[英]How to save custom preferences of python's 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.我在不同的位置有几台计算机,虽然我没有在 IDLE 中编码,但它总是在后台运行,用于小型测试、调试和研究任务。 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.我在家里配置了 IDLE 自定义突出显示、键集等,将我的设置保存到外部文件中,并将这些设置安装到我正在使用的任何机器上会很舒服。

So my question: is there a way to do that?所以我的问题是:有没有办法做到这一点?

Or it would be also nice, if anyone knows where IDLE stores these datas — probably I can copy the file(s) from there..或者这也很好,如果有人知道 IDLE 存储这些数据的位置——也许我可以从那里复制文件..

Thanks in advance!提前致谢!

IDLE saves its preferences in several files in the $HOME/.idlerc directory, creating the files (for example, config-main.cfg ) as needed. IDLE 将其首选项保存在$HOME/.idlerc目录中的多个文件中,并根据需要创建文件(例如, config-main.cfg )。 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:有一些潜在的问题需要注意:

  • When you copy the files to another home directory, make sure no IDLE instances are running.将文件复制到另一个主目录时,请确保没有 IDLE 实例正在运行。

  • Be aware that currently all versions of IDLE (with Python 2.7, 3.2, 3.3, etc) share the same .idlerc directory and files.请注意,当前所有版本的 IDLE(使用 Python .idlerc等)共享相同的.idlerc目录和文件。 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.我不知道在这一点上有任何重大冲突,除了可能是最近文件名带有需要 Unicode 表示的非 ASCII 字符的文件:这可能会导致 IDLE 2.x 和 3.x 之间的共享问题。

  • Another issue might be line endings if you attempt to share files between Windows and non-Windows systems.如果您尝试在 Windows 和非 Windows 系统之间共享文件,则另一个问题可能是行尾。

It is in ".idlerc" named folder in your users directory in windows 10它位于 Windows 10 用户目录中的“.idlerc”命名文件夹中

here are the steps这是步骤

  1. press win+R OR simply search in windows search (the taskbar one)按 win+R简单地在Windows 搜索中搜索(任务栏之一)
  2. then paste %USERPROFILE%\\.idlerc然后粘贴%USERPROFILE%\\.idlerc
  3. hit enter按回车

copy all files in it to wherever you may like to (a usb in your case)将其中的所有文件复制到您想要的任何位置(在您的情况下为 USB)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM