如何添加一些东西到PYTHONPATH? [英] How to add something to PYTHONPATH?

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

问题描述

我将一个软件包(称为pysolr 2.0.15)下载到我的电脑上,以便与Haystack一起使用。说明要求我将Pysolr添加到我的PYTHONPATH。

I downloaded a package (called pysolr 2.0.15) to my computer to be used with Haystack. The instructions asks me to add pysolr to my PYTHONPATH.

这是什么意思?解压缩pysolr文件后,我运行了命令python setup.py install,就是这样。这是做什么,我需要做什么?

What exactly does that mean? After extracting the pysolr files, I ran the command python setup.py install and that's about it. What did that do and do I need to do anything else?

感谢您的帮助!

推荐答案

pythonpath告诉python要查找模块,例如,你可能已经编写了一个你想在多个应用程序中使用的库,并将其存储在路径/ mylibs / python /
你然后必须添加该路径到pythonpath为python找到它。

The pythonpath tells python were to look for modules, for example you might have written a library that you want to use in several applications and stored it in the path /mylibs/python/ you would then have to add that path to the pythonpath for python to find it.

如果您已经下载了一个python模块或库(我不太确定这里的命名约定),并且您已经将其保存在随机的位置您的电脑,那么你必须将它添加到你的pythonpath。

If you've downloaded a python module or library (I'm not really sure about the naming convention here) and you've just saved it in a random place on your computer, then you have to add it to your pythonpath.

但是,如果你使用easy_install或PIP,那么你不必担心。

However if you used easy_install or PIP then you dont have to worry.

要在* nix系统中为python-path添加一些内容:

To add something to the python-path in a *nix system you write:

export PYTHONPATH=$PYTHONPATH:/<path_to_modules>

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

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