如何更新Python egg中的文件

5 投票
2 回答
19944 浏览
提问于 2025-04-16 04:17

我们正在使用trac。在我们的设置中,有一个问题已经在代码库里解决了。所以我从代码库里拿到了修复好的文件commit_update.py,我需要把它放到Trac-0.12-py2.6.egg里。

因为egg文件其实就是一个压缩包,所以我把它解压了,修改了文件,然后又重新压缩了一下。重启trac后,我收到了一个错误信息:

ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg 
cache:

    [Errno 20] Not a directory

The Python egg cache directory is currently set to: 

    /var/trac/plugin-cache

Perhaps your account does not have write access to this directory?  You can 
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

我不太明白为什么会出现这个错误,因为我是在www-data用户下运行trac,而这个用户也是插件缓存的拥有者。

任何建议都非常感谢。

2 个回答

3

我只是用下面的命令解压了这个egg文件:

sudo unzip django_tastypie-0.9.11-py2.7.egg

这会在同一个路径下创建一个叫做tastypie的新文件夹。然后,我把文件放进这个文件夹里,之后我就把egg文件删掉了,只保留这个新文件夹继续使用。

7

只需要新建一个蛋(用 python setup.py bdist_egg 这个命令),然后重新安装这个蛋,最后重启你的 trac 实例就可以了。

撰写回答