一、dist-packages和site-packages的区别

  1. sudo apt-get install 安装的package存放在/usr/lib/python2./dist-packages目录中
  2. pip 或者 easy_install安装的package存放在/usr/local/lib/python2./dist-packages目录中
  3. 手动从源代码安装的package存放在site-packages目录中
  4. 自己手动升级或安装的python,通过pip或者easy_install安装的package存放在/usr/local/lib/python2./site-packages 目录中
  5. 非root用户,通过pip或者easy_install安装的package存放在~/.local/lib/python2./site-packages

The dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu. Modules are installed to dist-packages when they come from the Debian package manager into this location:

/usr/lib/python2./dist-packages

Since easy_install and pip are installed from the package manager, they also use dist-packages, but they put packages here:

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

From the Debian Python Wiki:

dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.

This means that if you manually install Python from source, it uses the site-packages directory. This allows you to keep the two installations separate, especially since Debian and Ubuntu rely on the system version of Python for many system utilities.

二、查看python的库路径

terminal进入python命令行界面

>>>from distutils.sysconfig import get_python_lib
>>>print(get_python_lib())

【python】dist-packages和site-packages的区别的更多相关文章

  1. Python 安装路径, dist-packages 和 site-packages 区别

    Stack Overflow's answer 译: dist-packages is a Debian-specific convention that is also present in its ...

  2. python _、__和__xx__的区别

    python _.__和__xx__的区别 本文为译文,版权属于原作者,在此翻译为中文分享给大家.英文原文地址:Difference between _, __ and __xx__ in Pytho ...

  3. python中import和from...import...的区别

    python中import和from...import...的区别: 只用import时,如import xx,引入的xx是模块名,而不是模块内具体的类.函数.变量等成员,使用该模块的成员时需写成xx ...

  4. 转发 python中file和open有什么区别

    python中file和open有什么区别?2008-04-15 11:30地痞小流氓 | 分类:python | 浏览3426次python中file和open有什么区别?都是打开文件,说的越详细越 ...

  5. Python新式类与经典类的区别

    1.新式类与经典类 在Python 2及以前的版本中,由任意内置类型派生出的类(只要一个内置类型位于类树的某个位置),都属于“新式类”,都会获得所有“新式类”的特性:反之,即不由任意内置类型派生出的类 ...

  6. Python import与from import使用及区别介绍

    Python程序可以调用一组基本的函数(即内建函数),比如print().input()和len()等函数.接下来通过本文给大家介绍Python import与from import使用及区别介绍,感 ...

  7. 【转】python类中super()和__init__()的区别

    [转]python类中super()和__init__()的区别 单继承时super()和__init__()实现的功能是类似的 class Base(object): def __init__(se ...

  8. Python新式类和经典类的区别

    @Python新式类和经典类的区别 class ClassicClass(): pass class NewStyleClass(object): pass x1 = ClassicClass() x ...

  9. Python3.x:python: extend (扩展) 与 append (追加) 的区别

    Python3.x:python: extend (扩展) 与 append (追加) 的区别 1,区别: append() 方法向列表的尾部添加一个新的元素.只接受一个参数: extend()方法只 ...

  10. Python中str()与repr()函数的区别——repr() 的输出追求明确性,除了对象内容,还需要展示出对象的数据类型信息,适合开发和调试阶段使用

    Python中str()与repr()函数的区别 from:https://www.jianshu.com/p/2a41315ca47e 在 Python 中要将某一类型的变量或者常量转换为字符串对象 ...

随机推荐

  1. 2019ExcelVBA一些自己掉进过的坑

    1.公式手动重算问题 为避免代码执行过程中引发公式自动重算,拖慢运行速度,在代码中设置了公式手动重算,并计划在代码执行结束前恢复.如果在代码执行过程中捕获错误就直接退出,而没有执行到恢复公式自动重算, ...

  2. 页面检测网络外网连接- 网页基础模块(JavaScript)

    方法一 html 添加图片标签 加载外站图片 <img id="connect-test" style="display:none;" onload=&q ...

  3. CRM的组织架构

    PPOMA_CRM... 和ERP的组织架构一样的. 这边在功能参数里匹配ECC的组织.ECC的组织架构则会设置控制范围,成本中心啊,业务范围,公司,人事范围等. 下面说说常见函数RH_STRUC_G ...

  4. 注册COMDLG32.OCX方法

    1.将下载的comdlg32.ocx文件拷贝到C:\Windows\SysWOW64(32位电脑为C:\Windows\System32)文件夹中. 2.按win+x打开快捷命令选项菜单: 再按“A” ...

  5. Electron "jQuery/$ is not defined" 解决方法

    参考问题:https://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined <!-- Insert this ...

  6. learning makefile grammar

  7. Spring mvc初学

    转自:http://www.cnblogs.com/bigdataZJ/p/springmvc1.html 从今天起,准备好好审视并学习Spring mvc. 虽然从学java的第一个程序——hell ...

  8. leetcode python 032 识别最长合法括号

    # 给定一个只包含字符'('和')'的字符串,# 找到最长的有效(格式良好)括号子字符串的长度.# 对于“(()”,最长的有效括号子串是“()”,其长度为2.# 另一个例子是“)()())”,其中最长 ...

  9. A JSON example

    heroes.html<!DOCTYPE html> <html> <head> <meta charset="utf-8"> &l ...

  10. talk with gao about qssp