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

请教一个问题,关于 virtualenv

  •  
  •   rocxto · Jun 22, 2014 · 3848 views
    This topic created in 4377 days ago, the information mentioned may be changed or developed.
    在服务上部署的时候,怎么自动激活虚拟环境(网上所有的教程好像都没有这一步)?有经验的同学解答下,谢谢~
    7 replies    2014-06-22 11:18:43 +08:00
    sfdye
        1
    sfdye  
       Jun 22, 2014
    gunicorn配置文件里面设置,或者用fabric


    参考我的这边[博客](http://sfdye.com/articles/django-best-practice-and-deployment-with-nginx-gunicorn-and-supervisor/)吧
    likang
        2
    likang  
       Jun 22, 2014
    直接用虚拟环境中的 python 执行你的 py 代码

    如: /path/to/your/env/bin/python foo.py
    awanabe
        3
    awanabe  
       Jun 22, 2014   ❤️ 1
    bash执行第一步 source 一下 指定 virtualenv中的 activate 文件.
    具体就是 source virtualenv/xxxproject/bin/activate 就可以.
    awanabe
        4
    awanabe  
       Jun 22, 2014
    如果想要 当前服务器的python环境都使用这一个虚拟环境, 就直接在个人的bashrc中 加上source这一段. 然后登陆默认就是这个环境, 执行脚本也是当前虚拟环境. 就不需要每次都source一下
    rocxto
        5
    rocxto  
    OP
       Jun 22, 2014
    @sfdye @likang 谢谢
    rocxto
        6
    rocxto  
    OP
       Jun 22, 2014
    @awanabe 谢谢
    rocxto
        7
    rocxto  
    OP
       Jun 22, 2014
    懂了,结贴:)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3333 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 11:35 · PVG 19:35 · LAX 04:35 · JFK 07:35
    ♥ Do have faith in what you're doing.