2016-06-09 66 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 
相關問題