如何添加到Windows 7中的pythonpath? [英] How to add to the pythonpath in windows 7?

查看:169
本文介绍了如何添加到Windows 7中的pythonpath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目录,托管我所有的Django应用程序( C:\My_Projects )。我想将此目录添加到我的 pythonpath 中,所以我可以直接调用应用程序。

I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my pythonpath so I can call the apps directly.

我尝试添加 C:\My_Projects\; 到我的路径变量从Windows GUI(我的电脑>属性>高级系统设置>环境变量)。但是它仍然没有读取coltrane模块并生成此错误:

I have tried adding C:\My_Projects\; to my Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error:


错误:没有名为coltrane的模块

Error: No module named coltrane


推荐答案

你知道在Windows上对我来说真的很好。

You know what has worked for me really well on windows.

我的电脑>属性>高级系统设置>环境变量>

然后在系统变量下创建一个名为的新变量PythonPath 。在这个变量中,我有 C:\Python27\Lib; C:\Python27\DLLs; C:\Python27\Lib\lib-tk; C:\other-folders -on-the-path

Then under system variables I create a new Variable called PythonPath. In this variable I have C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\other-folders-on-the-path

这是为我提供的任何文档中没有找到的最好的方法。

This is the best way that has worked for me which I hadn't found in any of the docs offered.

编辑:对于那些无法得到它的人,
请添加

For those who are not able to get it, Please add


C:\Python27;

C:\Python27;

否则将永远不会。

along with it. Else it will never work.

这篇关于如何添加到Windows 7中的pythonpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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