2016-06-09 65 views
1

IM在一个CentOS 6.5具有的Python 2.6.6,我也已经安装了Python 2.7.5设置PYTHONPATH有两个不同的版本

问题的工作是我想要导入QGIS和使用Python 2.7.5工程。

在蟒蛇2.6.6如果我写

from qgis.core import * 

是没有问题的,但是当我通过键入与Python 2.7试图SCL使python27 bash和IMPOR的moudle返回

from qgis.core import * 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named qgis.core 

任何帮助?我尝试添加到PYTHONPATH在安装QGIS的路径,但没有奏效

回答

0

请使用Python的虚拟环境中,如果你需要支持多个蟒蛇在同一台计算机上的多个应用程序:

https://packaging.python.org/en/latest/installing/#creating-virtual-environments

例子创建虚拟环境并在其中安装qgic:

virtualenv -p python2.7 venv # Create Python installation in venv folder 
    source venv/bin/activate # Activate this environment 
    pip install qgis # Replace this with installation instructions from qgis package 
相关问题