How did my anaconda change to use Python 2.7?

烈酒焚心 提交于 2021-01-29 08:08:35

问题


I installed Anaconda for Python 3.7, and I created an environment tf to install lots of library, including iPython. After I logged into iPython terminal, I can see that it is using Python 3.6. I have been using environment for a while.

However, today after I use conda install pil to install a library, i can see that a lot of libraries are updated. After the installation, when I logged into iPython again, it shows that "Python 2.7.15" in the same environment tf.

How can I switch back to use Python 3 in the environment tf? I don't understand how this get changed. Weird.


回答1:


The thing is--- yes it's annoying--- that Anaconda is studious about managing dependencies for you. So if your version of pil doesn't work with Python3 Anaconda will put Python2 in your environment for you. A solution would probably be this.

In other words, you need pillow not pil




回答2:


Anaconda manages dependencies and the python environment for your libraries, this being said Pil is for Python2 and Pillow is for Python3 more about that here.

If you would like to you Pil in a Python3 environment l would advise setting up a virtual environment. This link might help. With setting up virtual environments with different Python versions.

Finally of your desire is upgrading your anaconda to a Python 3 version you can use the command.
conda install python==$pythonversion$ , here '$pythonversion$' is the python version you desire 3.6.5 or otherwise



来源:https://stackoverflow.com/questions/54374254/how-did-my-anaconda-change-to-use-python-2-7

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