Using multiple versions of Python

前端 未结 7 657
温柔的废话
温柔的废话 2020-12-06 10:25

I have both Python 3.3 and Python 2.7 installed on my computer. The python 3.3 works fine, but when I try to run something using python 2.7, it is still referencing python

7条回答
  •  旧时难觅i
    2020-12-06 10:46

    Changing the executable files isn't an option for everyone, and uninstalling can risk breaking programs that depend on that Python installation.

    My answer here doesn't guarantee that you can run both versions side by side seamlessly, but I was able to resolve it without something as major as uninstalling.

    In my case, the problem was that the PYTHONPATH and PYTHONHOME environment variables were both set to the 3.x installation path, whereas I needed to use the 2.x installation. Replacing these environment variables with the 2.x path and restarting the shell was an acceptable workaround for me.

提交回复
热议问题