在mac下查找python包存放路径site-packages的实现方法

时间:2022-09-14 13:05:01

想查找macpythonsite-packages目录,如果用网上搜的安装目录之类的去找,进去每一层很多都是软链接形式存在,比较浪费时间;

 

比较快捷的方法如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
MacBook-Pro-6:Scrapy-1.5.0 haizhi$ python
 
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
 
Type "help", "copyright", "credits" or "license" for more information.
 
>>> import sys
 
>>> print(sys.path)
 
['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages/Scrapy-1.5.0-py2.7.egg']
 
>>>

以上这篇在mac下查找python包存放路径site-packages的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/qq_42512064/article/details/80977336