Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Cách tìm vị trí thư mục site-packages của Python?


Bạn có thể tìm vị trí thư mục site-packages của Python bằng module site như sau:

>>> import site
>>> site.getsitepackages()
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

Nếu muốn thư mục site-packages cho từng user, chạy lệnh sau trong shell:

$ python -m site --user-site