python的模块路径

潘达的熊猫 发布于 2013/11/10 12:26
阅读 935
收藏 0

本人是新手,自学的python,目前遇到了一个困难,就是python的路径

我始终无法理解这个usr指的是哪里,还有如何设置准确的路径,书上看到的path用下来一直出错,完全迷茫了

加载中
0
首席安全砖家
首席安全砖家

假定你的是linux 系统的话, 安装模块的路径在 

/usr/local/lib/python2.7/dist-packages

0
mallon
mallon
python默认有模块路径指向约定的目录,如果要额外添加,加到PYTHONPATH环境变量中即可
0
PYPlus
PYPlus
In [1]: import sys

In [2]: sys.path
Out[2]: 
['',
 '/usr/local/ipython33',
 '/usr/local/ipython33',
 '/usr/local/python33/lib/python3.3/site-packages/setuptools-0.9.8-py3.3.egg',
 '/usr/local/python33/lib/python3.3/site-packages/ipython-1.0.0-py3.3.egg',
 '/usr/local/python33/lib/python33.zip',
 '/usr/local/python33/lib/python3.3',
 '/usr/local/python33/lib/python3.3/plat-linux',
 '/usr/local/python33/lib/python3.3/lib-dynload',
 '/usr/local/python33/lib/python3.3/site-packages',
 '/usr/local/ipython33/IPython/extensions']
返回顶部
顶部