V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hell0v2
V2EX  ›  Python

root 用 python3 setup.py install 安装 psutil,其他用户 import 时找不到模块

  •  
  •   hell0v2 · 2020-01-09 16:45:10 +08:00 · 2724 次点击
    这是一个创建于 1540 天前的主题,其中的信息可能已经有所发展或是发生改变。
    已在其他非 root 用户环境变量加 PYTHONPATH,把 site_packages 路径加进去;
    已把 site_packages 下的 psutil-5.6.7-py3.7-linux-x86_64.egg 文件夹赋权 chmod -R 755
    有的环境 ok,有的环境,其他非 root 用户引用模块失败,求各路神仙指点迷津。。。
    另外,这个库安装,默认其他组用户没权限,有的三方库是有权限的,这个在哪里能改的啊?
    8 条回复    2020-01-14 23:38:13 +08:00
    nuistzhou
        1
    nuistzhou  
       2020-01-09 21:23:42 +08:00
    用 conda 的 python 环境啊,自然就不需要 root 权限装 library 了
    keakon
        2
    keakon  
       2020-01-09 23:54:07 +08:00
    用 virtualenv
    hell0v2
        3
    hell0v2  
    OP
       2020-01-10 08:48:39 +08:00
    @nuistzhou 只是要用 python3 的 psutil 这个库,而且都需要离线安装,因此只能这样。。
    hell0v2
        4
    hell0v2  
    OP
       2020-01-10 08:49:35 +08:00
    @keakon 需求是安装 python3 和 psutil 这个库,保持干净,且都是离线安装,因此就没考虑 virtualenv。。
    Latin
        5
    Latin  
       2020-01-10 11:09:45 +08:00
    777 解君忧
    keakon
        6
    keakon  
       2020-01-10 14:07:24 +08:00
    离线安装有 pip 就行
    hell0v2
        7
    hell0v2  
    OP
       2020-01-10 14:24:51 +08:00
    @Latin 理论上 755 权限足够了,而且试过 777 了,还是一样的情况;哎 这个 psutil 库有点神奇
    xchaoinfo
        8
    xchaoinfo  
       2020-01-14 23:38:13 +08:00
    python -m venv 虚拟环境啊,谁用的时候激活下就 OK 了啊

    pip 可以直接安装离线包的, 不需要 python3 setup.py xxx
    sudo pip install xxx.whl 或者 sudo pip install xxx.tar.gz
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3030 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:52 · PVG 22:52 · LAX 07:52 · JFK 10:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.