更改命令提示符的默认python版本 [英] Change default python version for command prompt

查看:702
本文介绍了更改命令提示符的默认python版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的机器上,我安装了python3.4和最近下载的python3.6,我想将python3.6设置为命令提示符中使用的默认python.

On my machine I have python3.4 and a recently downloaded python3.6 installed, I would like to set python3.6 as my default python used in command prompt.

我已经删除了python34路径变量,但是当我通过命令提示符访问python时,它仍然默认为打开python3.4.我看到了这个问题关于访问非默认python的信息,但这是针对特定文件的.

I have removed the python34 path variable but my when I access python through the command prompt it still defaults to opening python3.4. I saw this question about access the non default python but that was for specific files.

自发布问题以来:

我还从系统路径变量中删除了python34.

I have also removed python34 from the system path variables.

在命令提示符下键入where python会返回以下内容:

Typing where python in command prompt returns this:

C:\>where python
C:\Python34\python.exe
C:\Python36\python.exe

键入echo %PATH%返回

C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python34;;C:\WINDOWS\System32\OpenSSH\;C:\Python36\Scripts\;C:\Python36\;C:\Users\ME\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;

建议的重复项上接受的答案指出有可能,但是您不应该这样做,也没有提供有关操作方法的详细信息.

The accepted answer on the proposed duplicate states it is possible but you shouldn't do it, and doesn't give details on how to do it.

推荐答案

从系统路径变量中删除python34(注释中提到的@Talha Junaid)后,重启机器后,我的python现在默认为python3.6通过命令提示符访问Windows时,Windows必须在启动时加载所有路径变量并将其保存在内存中,直到重新启动.

After doing a restart of my machine after deleting python34 from my system path variables as @Talha Junaid mentioned in the comments, my python now defaults to python3.6 when accessed through command prompt, windows must load all the path variables on startup and hold them in memory until a restart occurs.

其他任何人开始该过程的步骤.

Steps for anyone else starting the process.

Windows 10

  1. 在搜索栏中键入系统"以转到控制面板(控制面板\所有控制面板项目\系统)中的系统设置

  1. Type "System" into the search bar to go to system settings in the control panel (Control Panel\All Control Panel Items\System)

单击高级系统设置"-> 2环境变量2

Click "Advanced System Settings" -> 2Environment Variables2

对于用户变量:

  1. 通过突出显示路径"行,然后单击编辑"按钮
  2. 通过突出显示您要从环境变量中删除的python版本,然后单击删除"按钮来突出显示.

对系统环境变量重复步骤3和4.

Repeat steps 3 and 4 for System Environment Variables.

  1. 通过单击确定"按钮关闭所有窗口

  1. Close all the windows by clicking the "Ok" buttons

重新启动计算机

这篇关于更改命令提示符的默认python版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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