如何在Linux中包含python模块? [英] how to include python modules in linux?
问题描述
我发现了这个xgoogle python模块 http://github.com/pkrumins/xgoogle ,非常有趣.我应该如何准确地在Linux中包括或安装这些文件?
I found this xgoogle python modules http://github.com/pkrumins/xgoogle, very interesting. How exactly should i include or install these files in linux??
如果我想使用xgoogle python模块做类似的事情?
if i want to do something like this using xgoogle python module?
>>from xgoogle.search import GoogleSearch
我知道我们可以使用from,import来使用模块,但是要包括一个外部模块,我该怎么办?我需要安装模块还是什么?
I know that we can use from, import to use modules, but to include an external module, what should i do? Should i need to install module or what?
推荐答案
您可以执行通常的安装舞蹈:
You could either do the usual install dance:
python setup.py install
或仅将文件包含在已知目录中,然后将该目录包含在PYTHONPATH中:
or simply include the files in a known directory and include that directory in the PYTHONPATH:
$ export PYTHONPATH=/contains/modules:$PYTHONPATH
这是有关安装Python模块的详细文档: http://docs.python.org/install/
Here's a detailed documentation on Installing Python Modules: http://docs.python.org/install/
这篇关于如何在Linux中包含python模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!