大家好,请问在python脚本中怎么用virtualenv激活指定的环境?
伊谢尔伦
伊谢尔伦 2017-04-18 10:24:27
0
3
830

我是想在py脚本执行时,激活指定的环境。可以做到吗?

PS:我是李世石,我已经弃围棋从AI了,大家多指教!

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (3)
洪涛

sys.path.insertYour environment directory. For example:

sys.path.insert(0, "/tmp/python2.7.8/lib/python2.7/site-packages/")
    Ty80

    Yes, you need to use the absolute path to specify the python you use (in the virtual environment). The rough writing method is as follows

    /PATH/venv/bin/python /PATH/script.py
      刘奇

      Spend half an hour and read through the documentation of virtualenvwrapper, and all the problems will be solved

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!