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

2020-10-23 18:36:17 +08:00
 jeeyong

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"
}

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

750 次点击
所在节点    程序员
1 条回复
jeeyong
2020-10-24 17:22:05 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/717979

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX