sys.path 的 python easy_install.pth

发布于 2024-11-16 17:39:58 字数 381 浏览 4 评论 0原文

我查看了 /usr/local/lib/python2.6/dist-packages 中的 easy_install.pth 文件,我认为这是我通过 easy_install 下载软件包时的默认目录。在 easy_install.pth 中,条目之一是目录本身,即 /usr/local/lib/python2.6/dist-packages。但是,当我检查 sys.path 时,路径本身不包含 /usr/local/lib/python2.6/dist-packages

我这么说只是因为我下载了一个包,并认为只需将其放入 /usr/local/lib/python2.6/dist-packages 目录即可使用它。

I looked at my easy_install.pth file in /usr/local/lib/python2.6/dist-packages, which I think is the default directory when I download packages via easy_install. Inside easy_install.pth, one of the entry is the directory itself, i.e /usr/local/lib/python2.6/dist-packages. However, when I check sys.path, /usr/local/lib/python2.6/dist-packages is not included in the path itself.

I'm only saying this because I downloaded a package and thought I can use it simply by putting it in /usr/local/lib/python2.6/dist-packages directory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

來不及說愛妳 2024-11-23 17:39:58

easy_install 工具会将其安装在适合您的位置。如果您不或无法以 root 身份运行它,那么您可以将新包放置在您的私人位置。

easy_install-2.6 --user 

将安装在您的主目录中。

The easy_install tool installs it in the right place for you. If you don't or can't run it as root then you can place new packages in your private locate.

easy_install-2.6 --user 

Will install in your home directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文