Is it ok to install both Python 2.7 and 3.5?

前端 未结 7 1120
有刺的猬
有刺的猬 2021-01-04 02:02

Supposedly Python 2.7 is included native to OSX 10.8 and above (if I remember correctly), but I recently installed Python 3.5 to use for projects while I work through UDacit

相关标签:
7条回答
  • 2021-01-04 02:20

    You can also use Anaconda for maintaining two versions of Python:

    1. Download Anaconda for both Python versions

    2. Open .bashrc

    3. Add the path to new Anaconda you have installed for, e.g.:

      export PATH="/home/paras/anaconda3/bin:$PATH"
      
    4. Now there will be 2 export paths: one for Python 2 and one for Python 3. Comment the one which you don't want.

    0 讨论(0)
  • 2021-01-04 02:24

    As long as you keep your installation folders organized, you should have no issues having both on your computer, besides one thing. The path environment variable for python will determine which version is used by default, so I would say stick to one version, or make sure to make your programs as backwards compatible as possible. I have run into this issue on Windows, since I installed Python 3.4 before 2.7, and therefore to run older code, I have to manually select the python executable. In terms of libraries, I believe that for each python version, the libraries are completely separate, so you should be good there.

    0 讨论(0)
  • 2021-01-04 02:25

    Im not sure about OSX, but with windows 10 my environment variables for 2.7 were overwritten with the 3.5 path. Not a tough fix, but a little confusing, since it was months later when I needed 2.7 again.

    0 讨论(0)
  • 2021-01-04 02:27

    As others have said, if the installation directory is different it should be no problem at all.

    One thing that'll make your life easier for switching between the two is to use an IDE such as PyCharm, you just have to change a drop down to switch between the two versions.

    0 讨论(0)
  • 2021-01-04 02:33

    I have the same problem and it is not necessary to uninstall on version of python. Please take care to not mix them up - When you search them up on the start menu. You can make a desktop shortcut saying 2.6 and 3.5.

    0 讨论(0)
  • 2021-01-04 02:35

    It should be fine. Its actually pretty common to have multiple Python environments. It helps to prevent dependency conflicts between your projects. That is what is happening when you are using tools like pyenv and virtualenv.

    Using tools like pyenv and virtualenv may also help you with the path problems that others mentioned. They have commands to set up the path so that their version of pip, python, etc are used.

    0 讨论(0)
提交回复
热议问题