推荐学习书目
› 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
vansarw
V2EX  ›  Python

sudo 时 pyenv 的 global 环境失效如何处理

  •  
  •   vansarw · Jun 4, 2018 · 4772 views
    This topic created in 3034 days ago, the information mentioned may be changed or developed.
    学习在 ubuntu14 + apache 上部署 flask 时遇到错误,看了下错误日志提示说 import flask 失败。

    用 pyenv 做的 python 版本管理,由于基本上只用 python3,所以就直接 pyenv global 3.6.5,flask 也是安装在 python3 下面。尝试用 sudo python 时发现 python 的版本依然是系统默认版本(2.7.6), 看情况应该是在 sudo 是 pyenv 的 gobal 设置是无效的。

    这种情况应该如何处理,需要在系统默认版本上也安装 flask ?
    6 replies  •  2018-06-06 23:05:41 +08:00
    SingeeKing
        1
    SingeeKing  
       Jun 4, 2018
    sudo -H
    vansarw
        2
    vansarw  
    OP
       Jun 4, 2018
    @SingeeKing 没有效果,依然还是默认版本。
    Levox
        3
    Levox  
       Jun 4, 2018
    sudo -E
    momocraft
        4
    momocraft  
       Jun 4, 2018
    为什么跑 flask 会需要 sudo
    awanabe
        5
    awanabe  
       Jun 4, 2018 via iPhone   ❤️ 1
    @momocraft 估计想跑 80 端口吧
    请用 uwsgi 部署
    vansarw
        6
    vansarw  
    OP
       Jun 6, 2018
    @awanabe 是的,就是为了运行在 80 端口
    折腾了两天,改用 nginx+uWSGI 搞定了,多谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 22:40 · PVG 06:40 · LAX 15:40 · JFK 18:40
    ♥ Do have faith in what you're doing.