最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】CentOS中如何查看Python的site-packages位置

CentOS crifan 3693浏览 0评论

现在是一个Python的Django项目,本地由于需要支持jwt的error handler,所以更新了本地的python的jwt的代码:

/usr/local/lib/python3.6/site-packages/rest_framework_jwt

* `rest_framework_jwt/settings.py`

* `rest_framework_jwt/utils.py`

* `rest_framework_jwt/views.py`

而现在部署到在线服务器中,也需要去更新对应的库的代码,所以先要去搞清楚,如何找到在线的CentOS中的python3的site-packages的位置在哪里

此处知道别人之前是用pip3去安装的包

installation – How do I find the location of my Python site-packages directory? – Stack Overflow

<code>[root@naturling-general-01 xxx]# python3 -m site
sys.path = [
    '/root/naturling_20180101/web/server/NaturlingCmsServer',
    '/usr/lib64/python34.zip',
    '/usr/lib64/python3.4',
    '/usr/lib64/python3.4/plat-linux',
    '/usr/lib64/python3.4/lib-dynload',
    '/root/.local/lib/python3.4/site-packages',
    '/usr/lib64/python3.4/site-packages',
    '/usr/lib/python3.4/site-packages',
]
USER_BASE: '/root/.local' (exists)
USER_SITE: '/root/.local/lib/python3.4/site-packages' (exists)
ENABLE_USER_SITE: True
</code>

What is python’s site-packages directory? – Stack Overflow

pip show — pip 10.0.1 documentation

<code>[root@xx-general-01 NaturlingCmsServer]# pip3 show Django
Name: Django
Version: 2.0.6
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: [email protected]
License: BSD
Location: /usr/lib/python3.4/site-packages
Requires: pytz
Required-by: django-redis
</code>

【总结】

此处通过:

<code>python3 -m site
</code>

或:

<code>pip3 show Django
</code>

而知道此处的Django所在的Python3的site-packages的位置是:

/usr/lib/python3.4/site-packages

转载请注明:在路上 » 【已解决】CentOS中如何查看Python的site-packages位置

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.175 seconds, using 22.09MB memory