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

请教如何 Spawn 运行一个 virtualenv 配置的 Python3 程序,因为依赖的包都装在 virtualenv 里管理了,从 NodeJS 调用的。

  •  
  •   a251922581 · Oct 11, 2017 · 1960 views
    This topic created in 3271 days ago, the information mentioned may be changed or developed.
    目前是 NodeJS 的 child_process 想用 Spawn 之类的运行一个 Python3,python 在 virtualenv 的目录里,python 应用依赖的包也都在 virtualenv 里,
    Spawn 调用 /bin/python3.4 传递脚本路径,
    用环境变量"VIRTUAL_ENV"传递了 virtualenv 所在的目录 /opt/project/app1,Python 脚本用 os.environ['VIRTUAL_ENV']也识别到了,但是 import 包 就提示没有,是环境变量 VIRTUAL_ENV 这样使用不起作用吗。
    Thanks a lot.
    1 replies  •  2017-10-11 16:00:35 +08:00
    knightdf
        1
    knightdf  
       Oct 11, 2017
    直接 virtualenv/bin/python
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1281 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:58 · PVG 00:58 · LAX 09:58 · JFK 12:58
    ♥ Do have faith in what you're doing.