更改创建 .pyc 文件的目录 [英] Changing the directory where .pyc files are created

查看:30
本文介绍了更改创建 .pyc 文件的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法更改 Python 解释器创建 .pyc 文件的目录?我看到了关于该主题的两个 PEP(03043147),但似乎没有在默认解释器中实现(我正在使用 Python 3).

Is there a way to change the directory where .pyc file are created by the Python interpreter? I saw two PEPs about that subject (0304 and 3147), but none seems to be implemented in the default interpreter (I'm working with Python 3).

我错过了什么吗?

推荐答案

无法更改 .pyc 文件的位置.Python 3.2 实现了 __pycache__ 方案,所有 .pyc 文件都进入一个名为 __pycache__ 的目录.如果您确实需要保持目录清洁,Python 3.2 alpha 1 现在可用.

There's no way to change where the .pyc files go. Python 3.2 implements the __pycache__ scheme whereby all the .pyc files go into a directory named __pycache__. Python 3.2 alpha 1 is available now if you really need to keep your directories clean.

在 3.2 发布之前,配置尽可能多的工具以忽略 .pyc 文件.

Until 3.2 is released, configure as many tools as you can to ignore the .pyc files.

这篇关于更改创建 .pyc 文件的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆