我的蟒蛇如何更改为使用Python 2.7? [英] How did my anaconda change to use Python 2.7?

查看:66
本文介绍了我的蟒蛇如何更改为使用Python 2.7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Python 3.7安装了Anaconda,并创建了一个环境 tf 来安装许多库,包括iPython.登录iPython终端后,可以看到它正在使用Python 3.6.我已经使用环境一段时间了.

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.

但是,今天,在使用 conda install pil 安装库之后,我可以看到很多库都已更新.安装后,当我再次登录iPython时,它表明在同一环境 tf 中显示的是"Python 2.7.15".

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.

如何在 tf 环境中切换回使用Python 3?我不知道这是怎么改变的.很奇怪.

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

推荐答案

Anaconda为您的库管理依赖关系和python环境,这就是说 Pil 用于Python2和 Pillow 此处上有更多关于Python3的信息.

如果您想在Python3环境中 Pil ,我建议您设置一个虚拟环境.此链接可能会有所帮助.通过使用不同的Python版本设置虚拟环境.

最后,您希望将anaconda升级到Python 3版本,可以使用以下命令.
conda install python == $ pythonversion $ ,这里的'$ pythonversion $'是您想要的3.6.5或其他版本的python版本

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

这篇关于我的蟒蛇如何更改为使用Python 2.7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆