python模块存储在哪里? [英] Where are the python modules stored?
本文介绍了python模块存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近开始学习 Python,我有 2 个与模块相关的问题.
- 有没有办法获取机器上可用(即已安装)的 Python 模块列表?
- 我使用 Ubuntu Karmic 和 Synaptic 进行包管理.我刚刚安装了一个python模块.我的机器上实际存储的模块代码在哪里?(是否有存储模块的默认 [推荐] 位置)?
解决方案
- 有没有办法获得一个列表可用的 Python 模块(即安装)在机器上?
这对我有用:
help('modules')
<块引用>
- 模块代码实际在哪里存储在我的机器上?
通常位于 Python 文件夹中的 /lib/site-packages
中.(至少,在 Windows 上.)
您可以使用 sys.path
找出在哪些目录中搜索模块.
I have recently started learning Python and I have 2 questions relating to modules.
- Is there a way to obtain a list of Python modules available (i.e. installed) on a machine?
- I am using Ubuntu Karmic and Synaptic for package management. I have just installed a python module.Where is the module code actually stored on my machine? (is there a default [recommended] location that modules are stored)?
解决方案
- Is there a way to obtain a list of Python modules available (i.e. installed) on a machine?
This works for me:
help('modules')
- Where is the module code actually stored on my machine?
Usually in /lib/site-packages
in your Python folder. (At least, on Windows.)
You can use sys.path
to find out what directories are searched for modules.
这篇关于python模块存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文