V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jeeyong
V2EX  ›  程序员

[求助]sublime 的项目配置文件会自己恢复默认.

  •  
  •   jeeyong · 2020-10-23 18:36:17 +08:00 · 739 次点击
    这是一个创建于 1252 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ST3 + virtualenv + Anaconda 的环境. 做 Python 开发

    创建一个项目 编写 project 配置文件

    {
        "settings":
        {
            "python_interpreter": "D:\\coding\\web\\Scripts\\python.exe",
            "extra_paths":
            [
                "D:\\coding\\web\\Lib\\site-packages"
            ]
        },
        "build_systems":
        [
            {
                "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
                "name": "Anaconda Python Builder",
                "selector": "source.python",
                "env": {"PYTHONIOENCODING": "utf8"},
                "shell_cmd": "\"D:\\coding\\web\\Scripts\\python.exe\" -u \"$file\""
            }
        ],
        "folders":
        [
            {
                // "follow_symlinks": true,
                "path": "."
            }
        ],
        "virtualenv": "D:\\coding\\web"
    }
    

    主要是为了添加 Build_systems 中的"env": {"PYTHONIOENCODING": "utf8"},这个参数, 否则输出结果会乱码.

    配置好之后, 关闭工程. 再次打开工程, 选中任意.py 文件后再次查看 sublime-project 配置文件, 就会变成默认的配置: 之前添加的"env": {"PYTHONIOENCODING": "utf8"},没有了...

    {
    	"build_systems":
    	[
    		{
    			"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    			"name": "Anaconda Python Builder",
    			"selector": "source.python",
    			"shell_cmd": "\"d:\\code\\web\\Scripts\\python.exe\" -u \"$file\""
    		}
    	],
    	"folders":
    	[
    		{
    			"path": "."
    		}
    	],
    	"settings":
    	{
    		"extra_paths":
    		[
    			"D:\\code\\web\\Lib\\site-packages"
    		],
    		"python_interpreter": "D:\\code\\web\\Scripts\\python.exe"
    	},
    	"virtualenv": "D:\\code\\web"
    }
    

    一直想不通为什么...从哪个方向入手排查问题?

    1 条回复    2020-10-24 17:22:05 +08:00
    jeeyong
        1
    jeeyong  
    OP
       2020-10-24 17:22:05 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   999 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:05 · PVG 04:05 · LAX 13:05 · JFK 16:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.