QGIS包含一个python安装,我想在不启动QGIS的情况下使用它。
我可以找到可执行文件
c:\program files\qgis pisa\bin\python.exe
但是,如果我尝试运行它,Python说
ImportError: No module named site
大概是因为它无法找到其标准库。启动QGIS并从内部检查sys.path
,我看到了这个
C:/PROGRA~1/QGISPI~1/apps/qgis/./python/plugins\processing
C:/PROGRA~1/QGISPI~1/apps/qgis/./python
C:/PROGRA~1/QGISPI~1/apps/qgis/./python/plugins
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg
C:\PROGRA~1\QGISPI~1\bin\python27.zip
C:\PROGRA~1\QGISPI~1\apps\Python27\DLLs
C:\PROGRA~1\QGISPI~1\apps\Python27\lib
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\plat-win
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\lib-tk
C:\PROGRA~1\QGISPI~1\bin
C:\PROGRA~1\QGISPI~1\apps\Python27
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\PIL
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\win32
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\win32\lib
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\Pythonwin
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\six-1.3.0-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
C:\PROGRA~1\QGISPI~1\apps\qgis\python\plugins\fTools\tools
我建议标准库在
c:\program files\qgis pisa\apps\python27
所以我试试
set PYTHONHOME=c:\program files\qgis pisa\apps\python27
c:\program files\qgis pisa\bin\python.exe
但是,
ImportError: No module named site
从这里安装python的位置运行python的正确方法是什么?