将目录添加到 PYTHONPATH(多个驱动器),用于自动完成
我有 2 个硬盘,C:\
和 D:\
Django 正确导入(位于我的 C
驱动器中),但是我的应用程序位于我的 D
驱动器上。由于我正在运行一些备份软件,我无法将其移至 C 驱动器/
我正在尝试在 Komodo Edit 5 中使用自动完成功能,该功能对 Django 来说效果很好,但不适合我的应用程序。想要这样做还有其他一些原因(其中之一就是我猖獗的强迫症)。我已将 D:\dev\projects
添加到我的 PYTHONPATH
中,我的应用程序是从那里深入的几个文件夹。我在变量之间添加了 ;
但不在末尾,并且省略了尾部斜杠。我用的是Win XP。这是我的设置中的确切 PYTHONPATH:
C:\Python26\Lib\site-packages\django-trunk;D:\dev\projects
这是我的 Python 路径,作为 输出的列表os.environ['PYTHONPATH'].split(os.pathsep)
['C:\\Python26\\Lib\\site-packages\\django-trunk', 'D:\\dev \\projects']
为什么这不起作用? Django 对于我的应用程序运行正常,但我知道 Django 在 manage.py 中动态设置环境变量。我不明白。我重新启动了电脑,现在我正在拔头发。
I have 2 hard-drives, C:\
and D:\
Django imports correctly (which is in my C
drive), but my application is on my D
drive. I can't move it to the C
drive because of some back-up software I'm running/
I'm trying to get auto-complete to work in Komodo Edit 5 which works fine for Django, but not for my application. There are a few other reasons for wanting this as well (one of them being my rampant OCD). I have added D:\dev\projects
to my PYTHONPATH
and my application is a couple folders deep from there. I included a ;
between variables but not at the end, and I left off the trailing slash. I'm on Win XP. Here's my exact PYTHONPATH in my settings:
C:\Python26\Lib\site-packages\django-trunk;D:\dev\projects
and here is my Python path as a list output by os.environ['PYTHONPATH'].split(os.pathsep)
['C:\\Python26\\Lib\\site-packages\\django-trunk', 'D:\\dev\\projects']
Why doesn't this work? Django runs OK for my app that is there, but I understand that Django sets an environment variable dynamically in manage.py. I don't get it. I've restarted my computer, and now I'm pulling out my hair.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过在 Komodo 的 Languages/Python 下的 Edit/Preferences/ 中添加其他导入目录?
编辑:我认为您还可以在 [komodo-install-dir]/lib/mozilla/python/ 或 C:\[PythonVersion]\Lib\site-packages\ 中添加包含所有内容的 .pth 文件您可能希望使用的其他路径。不确定哪种方式更适合您的情况。
Have you tried adding Additional import directories in Edit/Preferences/ under Languages/Python in Komodo?
Edit: I think you can also add a .pth file in [komodo-install-dir]/lib/mozilla/python/ or C:\[PythonVersion]\Lib\site-packages\ containing all other path you might want to be available. Not sure wich way is more appropriate in your case.