我正在使用CentOS 6.5,它安装了Python2.6.6,我还安装了Python2.7.5
问题是我想导入qgis并使用Python 2.7.5。
在python 2.6.6中,如果我写道
from qgis.core import *没有问题,但是当我尝试使用Python2.7时,输入scl enable python27 bash并输入它返回的鼠标
from qgis.core import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named qgis.core有什么帮助吗?我尝试将qgis的安装路径添加到PYTHONPATH中,但没有成功
发布于 2016-06-10 07:16:06
如果您需要在同一台计算机上支持多个Python和多个应用程序,请使用Python虚拟环境:
https://packaging.python.org/en/latest/installing/#creating-virtual-environments
要创建虚拟环境并在其中安装qgic的EXample:
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 packagehttps://stackoverflow.com/questions/37737629
复制相似问题