[英]Not being able to change version of python from 2.7-3.6
I am trying python --version in my windows subsystem for linux terminal and it is showing me 2.7.15 whereas I do not have 2.7 in my system.我正在我的 windows 子系统中为 linux 终端尝试 python --version ,它向我显示 2.7.15 而我的系统中没有 2.7。 I have python 3.6 set in my environment variable, and that is the python interpreter I have used till date.
我在我的环境变量中设置了 python 3.6,这就是我迄今为止使用的 python 解释器。 Suddenly after restarting my system I could see that version is 2.7.
重新启动系统后突然我可以看到该版本是 2.7。 How do I change the version of python and set it to my original interpreter?
如何更改 python 的版本并将其设置为我的原始解释器? I have tried sudo apt update && upgrade and then sudo apt install python3 python3-pip ipython3.
我试过 sudo apt update && upgrade 然后 sudo apt install python3 python3-pip ipython3。 Did not help.
没有帮助。 Please help.
请帮忙。
Try python3 --version
or python3.6 --version
尝试
python3 --version
或python3.6 --version
Run these 2 commands运行这两个命令
pip install --upgrade virtualenv
virtualenv -p python3 envname
You can use python3 as python3
or python3.6
您可以将 python3 用作
python3
或python3.6
If you still want to use python3 with the python
command, edit your ~/.bash_profile file and add line alias python='python3'
and restart terminal如果您仍想将 python3 与
python
命令一起使用,请编辑您的 ~/.bash_profile 文件并添加行alias python='python3'
并重新启动终端
you can try using alternatives install
python 3.6 and try # alternatives --config python
and choose the alternative version您可以尝试使用
alternatives install
python 3.6 并尝试# alternatives --config python
并选择替代版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.