ChatGPT解决这个技术问题 Extra ChatGPT

Is it ok having both Anacondas 2.7 and 3.5 installed in the same time?

I am using currently Anaconda with Python 2.7, but I will need to use Python 3.5. Is it ok to have them installed both in the same time? Should I expect some problems? I am on a 64-bit Win8.

check the docs. Ultimately you will be using a virtualenv. The counterpart is that the virtualenv will be pretty heavy! because packages are not always compatible among different python versions (specially those with binary parts).
You will not use virtualenv directly but through the conda utility (it is an anaconda-specific version of virtualenv). You don't need to mess with windows PATH and installing two different versions of anaconda. I don't remember now but you can install both python2 and python3 in your anaconda.
so at the end of the day, is having two anaconda installs in the same computer a problem? may not be optimal, but i dont really care as long as it does not create crazy bugs

G
Grr

I use both depending on who in my department I am helping (Some people prefer 2.7, others 3.5). Anyway, I use Anaconda and my default installation is 3.5. I use environments for other versions of python, packages, etc.. So for example, when I wanted to start using python 2.7 I ran:

 conda create -n Python27 python=2.7

This creates a new environment named Python27 and installs Python version 2.7. You can add arguments to that line for installing other packages by default or just start from scratch. The environment will automatically activate, to deactivate simply type deactivate (windows) or source deactivate (linux, osx) in the command line. To activate in the future type activate Python27 (windows) or source activate Python27 (linux, osx). I would recommend reading the documentation for Managing Environments in Anaconda, if you choose to take that route.

Update

As of conda version 4.6 you can now use conda activate and conda deactivate. The use of source is now deprecated and will eventually be removed.


Suppose I activated Python2.7. How to set path to it to PyCharm for example?
@Dims I don't use PyCharm, but it looks like you can choose the environment in the Project Interpreters section of the Settings/Preferences dialog box. See Conda Support Creating Conda Environments for more details.
P
Padraic

My understanding is you don't need to install Anaconda again to start using a different version of python. Instead, conda has the ability to separately manage python 2 and 3 environments.


The utility name is conda. Snakes is just an example name.
Sorry, yeah; I've never used conda for more than one python version so I misread that.
Me neither. I still have a problem with the size of the virtual environments so I stick with one version.
Environments are active only after they are activated and only inside current shell. They are not systemwide, so you will be unable to provide path to python 2 if needed by third party programs.
This answer is a bit terse and too RTFM for this question. Maybe share the actual command to accomplish the OP's goal.
A
Axis

Yes you can.

You don't have to download both Anaconda.

Only you need to download one of the version of Anaconda and need activate other version of Anaconda python.

If you have Python 3, you can set up a Python 2 kernel like this;

python2 -m pip install ipykernel

python2 -m ipykernel install --user

If you have Python 2,

python3 -m pip install ipykernel

python3 -m ipykernel install --user

Then you will be able to see both version of Python!

If you are using Anaconda Spyder then you should swap version here:

https://i.stack.imgur.com/iLyh5.png

If you are using Jupiter then check here:

https://i.stack.imgur.com/dKtJU.png

Note: If your Jupiter or Anaconda already open after installation you need to restart again. Then you will be able to see.


A
Allan Nelson

I have python 2.7.13 and 3.6.2 both installed. Install Anaconda for python 3 first and then you can use conda syntax to get 2.7. My install used: conda create -n py27 python=2.7.13 anaconda


W
Will Nilges

Yes, It should be alright to have both versions installed. It's actually pretty much expected nowadays. A lot of stuff is written in 2.7, but 3.5 is becoming the norm. I would recommend updating all your python to 3.5 ASAP, though.


A lot of stuff is written in 2.7, but 3.5 is becoming the norm. How is that relevant, though? This answer seems to be implying that Anaconda 2.7 can only create environments with Python 2.7, Anaconda 3.5 with Python 3.5, etc.
Mate, this answer is 4 years old. if you feel it needs to be updated, be my guest. At this point I absolutely implore everyone to use Python 3.
A
Akash Sonthalia

Anaconda is made for the purpose you are asking. It is also an environment manager. It separates out environments. It was made because stable and legacy packages were not supported with newer/unstable versions of host languages; therefore a software was required that could separate and manage these versions on the same machine without the need to reinstall or uninstall individual host programming languages/environments.

You can find creation/deletion of environments in the Anaconda documentation.

Hope this helped.