Using two different Python Distributions

后端 未结 3 1912
时光说笑
时光说笑 2020-12-13 11:07

I currently have continuum analytics\' python distribution (called anaconda) downloaded and in use on my computer. My problem is that I want to use virtualenv for a flask p

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 11:47

    I guess the python is the same. What different is packages.

    I use root lib of anaconda. I create ANACONDA=/path/to/anaconda environment variable and use anaconda packages if the variable is defined:

    # if You want to run the script in anaconda - export ANACONDA=/path/to/anaconda
    import os
    try:
        os.environ["ANACONDA"]
        sys.path.insert(1, os.environ["ANACONDA"] + "/lib/python2.7/site-packages")
    except KeyError:
        pass
    

提交回复
热议问题