推荐学习书目
› 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 · Jan 9, 2020 · 3888 views
    This topic created in 2458 days ago, the information mentioned may be changed or developed.
    已在其他非 root 用户环境变量加 PYTHONPATH,把 site_packages 路径加进去;
    已把 site_packages 下的 psutil-5.6.7-py3.7-linux-x86_64.egg 文件夹赋权 chmod -R 755
    有的环境 ok,有的环境,其他非 root 用户引用模块失败,求各路神仙指点迷津。。。
    另外,这个库安装,默认其他组用户没权限,有的三方库是有权限的,这个在哪里能改的啊?
    8 replies  •  2020-01-14 23:38:13 +08:00
    flgn88
        1
    flgn88  
       Jan 9, 2020
    用 conda 的 python 环境啊,自然就不需要 root 权限装 library 了
    keakon
        2
    keakon  
       Jan 9, 2020
    用 virtualenv
    hell0v2
        3
    hell0v2  
    OP
       Jan 10, 2020
    @nuistzhou 只是要用 python3 的 psutil 这个库,而且都需要离线安装,因此只能这样。。
    hell0v2
        4
    hell0v2  
    OP
       Jan 10, 2020
    @keakon 需求是安装 python3 和 psutil 这个库,保持干净,且都是离线安装,因此就没考虑 virtualenv。。
    Latin
        5
    Latin  
       Jan 10, 2020
    777 解君忧
    keakon
        6
    keakon  
       Jan 10, 2020
    离线安装有 pip 就行
    hell0v2
        7
    hell0v2  
    OP
       Jan 10, 2020
    @Latin 理论上 755 权限足够了,而且试过 777 了,还是一样的情况;哎 这个 psutil 库有点神奇
    xchaoinfo
        8
    xchaoinfo  
       Jan 14, 2020
    python -m venv 虚拟环境啊,谁用的时候激活下就 OK 了啊

    pip 可以直接安装离线包的, 不需要 python3 setup.py xxx
    sudo pip install xxx.whl 或者 sudo pip install xxx.tar.gz
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   903 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 23:08 · PVG 07:08 · LAX 16:08 · JFK 19:08
    ♥ Do have faith in what you're doing.