一、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. Gerapy的简单使用

    1. Scrapy:是一个基于Twisted的异步IO框架,有了这个框架,我们就不需要等待当前URL抓取完毕之后在进行下一个URL的抓取,抓取效率可以提高很多. 2. Scrapy-redis:虽然S ...

  2. centos7.4安装nginx

    参考地址: https://blog.csdn.net/weixin_41048363/article/details/80236663 我这里没有使用阿帕奇之类的服务器,只搭建了node环境.所以并 ...

  3. PAT 1065 A+B and C (64bit)

    1065 A+B and C (64bit) (20 分)   Given three integers A, B and C in [−], you are supposed to tell whe ...

  4. Mac使用Shell(终端)SSH连接远程服务器

    先进入终端 输入:ssh -p 端口号 服务器用户名@ip (例如ssh -p 22 root@119.10.168.63)回车,到这会让你输入yes或者no来确认是否连接,输入yes回车 然后输入在 ...

  5. 02.redis安装

    因为我这里使用的是centos7 mini版本,需要安装gcc,通过下图显示命令安装gcc(因为redis是由C语言开发而来,所以需要安装gcc编译环境). linux安装好后可以区官网下载redis ...

  6. jsp请求转发与重定向区别小结

    1.当使用转发时,JSP容器将使用一个内部方法来调用目标页面,新的页面继续处理同一个请求,而浏览器不会知道这个过程; 2.重定向是第一个页面通知浏览器发送一个新的页面请求. 3.转发不改变URL,重定 ...

  7. JavaScript HTML DOM - 改变 CSS

    HTML DOM 允许 JavaScript 改变 HTML 元素的样式. 改变 HTML 样式 如需改变 HTML 元素的样式,请使用这个语法: document.getElementById(id ...

  8. ACM-ICPC 2018 南京赛区网络预赛B

    题目链接:https://nanti.jisuanke.com/t/30991 Feeling hungry, a cute hamster decides to order some take-aw ...

  9. mysql8.0.13 的docker镜像安装

    1.从docker中获取mysql8.0.13镜像 docker pull mysql:8.0.13通过 docker images 命令查看镜像是否获取到了 2.运行 mysql8.0.13 镜像 ...

  10. js带“.”的对象属性名怎么使用

    问题:这样的json对象(event) { "title": "title", "alert":"ding", &quo ...