Multilpe python versions and interpreters

江枫思渺然 提交于 2019-11-28 09:13:15

问题


I am trying to setup python 2.7.6 on my windows 7 machine (python 3.3.3 was installed first). When selecting the project interpreter after adding it in settings-project interpreter, I get this error

File "C:\Python33\Lib\site.py", line 173 file=sys.stderr) ^ SyntaxError: invalid syntax

When initially adding the python 2.7 interpreter in the settings page (as compared to adding the virtual environment above), it gives this error message

Cannot setup python SDK at C: .... . The SDK seems invalid.

I also get a similar error when adding any virtual env based on that interpreter.

I've added the python27 paths in the Paths box as in the picture, but it seems to be looking at the path set in windows. If I have to change that, doesnt that defeat the point of being able to select multiple interpreters?

Any help would be greatly appreciated.


回答1:


I made a really silly mistake: I was messing with PYTHONPATH instead of PATH. I added both PYTHON33 and PYTHON27 to my PATH and it worked.




回答2:


Try adding these commands before you run your UI

set PYTHONHOME=C:\Python33
set PYTHONPATH=C:\Python33\lib


来源:https://stackoverflow.com/questions/23399867/multilpe-python-versions-and-interpreters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!