简体   繁体   English

无法卸载 python 并获得 python 3

[英]not able to uninstall python and get python 3

i just started using python and i use VS Code.我刚开始使用 python 并且我使用 VS Code。

When i do当我做

python --verion

i get python version 2我得到 python 版本 2

py --version

i get python version 3我得到 python 版本 3

i wanted to install networkx which turned out to only work with python version 3. I did multiple things to change python version to 3 but could not.我想安装 networkx,结果证明它只适用于 python 版本 3。我做了很多事情来将 python 版本更改为 3,但不能。

So i decided to uninstall python and went to control panel and uninstalled所以我决定卸载 python 并去控制面板卸载

python
python launcher

and restarted the computer.并重新启动计算机。

But when i run但是当我跑步时

python --version

it still shows up python 2.7.18它仍然显示 python 2.7.18

and this is my where python output这是我的 python output

在此处输入图像描述

can anyone please help me to understand whats going on and how can i get python 3 to my system.谁能帮助我了解发生了什么以及如何将 python 3 安装到我的系统中。

在此处输入图像描述

My solution:我的解决方案:

I had already tried putting the python 3.1 path (default added by python when you click add path option while installing) above all path but had no intended outcome.我已经尝试将 python 3.1 路径(安装时单击添加路径选项时 python 默认添加)放在所有路径之上,但没有预期的结果。

What i did:我做了什么:

installed python again and this time added the path by myself and moved it to top.再次安装 python ,这次我自己添加了路径并将其移至顶部。

Now when i run现在当我跑步时

where.exe python it shows me three path, i don't know much but looks like there are two/three python in the system but it started showing python 3 for now. where.exe python 它显示了三个路径,我不太了解,但看起来系统中有两个/三个 python 但它现在开始显示 python 3。

my where.exe python output:我的 where.exe python output:

在此处输入图像描述

uninstalled已卸载

In windows If you do not have correct environment variable set then this is likely to cause the problem.在 windows 如果您没有设置正确的环境变量,那么这很可能会导致问题。

On your Powershell if you type $env:path or on command prompt echo %PATH%在 Powershell 上,如果您键入$env:path或在命令提示符echo %PATH%

you shall see your environment variable path which you have set,您将看到您设置的环境变量路径,

where-in, either you may not have path to directory of Python 3 or you have it appended after Python2.其中,您可能没有 Python 3 目录的路径,或者您将其附加在 Python2 之后。

ie: IE:

if your result show up as ( ... could be other paths in your variable) then only you will get python.exe to be pointing to your Python3 path:如果您的结果显示为( ...可能是变量中的其他路径),那么只有您会得到 python.exe 指向您的 Python3 路径:

...
C:\Python38\Scripts;C:\Python38;
...
C:\Python27\Scripts;C:\Python27\;
...

You can download anaconda launcher and it has many python environments like jupyter notebooks or spyder with python 3 support您可以下载 anaconda 启动器,它有许多 python 环境,如 jupyter 笔记本或支持 python 3 的 spyder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM