You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装Anaconda 2和3,如何在命令提示符切换至Python 3.6?

Hey there! Let's sort out this Python version switch problem for you. Since you've got both Anaconda 2 (with Python 2.7) and Anaconda 3 (with Python 3.6) installed, here are a few straightforward ways to get Python 3.6 running in your command prompt:

Method 1: Activate Anaconda 3's Environment (Cleanest Approach)

Anaconda's built-in environment management is designed for exactly this kind of version switching. Here's how to use it:

  • First, locate your Anaconda 3 installation path (on Windows, it's typically something like C:\Users\YourUsername\anaconda3).
  • Open Command Prompt, then run the activation script for Anaconda 3:
    C:\Users\YourUsername\anaconda3\Scripts\activate.bat
    
    Make sure to replace the path with your actual Anaconda 3 install location.
  • Once the environment is activated, run python --version again—you should see Python 3.6. To switch back to Python 2.7 later, just run deactivate in the prompt.
Method 2: Adjust System PATH to Make Python 3.6 Default

If you want Python 3.6 to be the default whenever you open Command Prompt, tweak your system's PATH variable:

  • Right-click "This PC" → Properties → Advanced System Settings → Environment Variables.
  • In the "System Variables" section, find the PATH variable and click Edit.
  • Look for the entries related to Anaconda 2 (they'll look like C:\Users\YourUsername\anaconda2 and C:\Users\YourUsername\anaconda2\Scripts). Move these entries below the Anaconda 3 entries (C:\Users\YourUsername\anaconda3 and C:\Users\YourUsername\anaconda3\Scripts).
  • Save your changes, close and reopen Command Prompt. Now python --version should show Python 3.6 by default.
Method 3: Run Python 3.6 Directly (One-Time Use)

If you just need to run a single script with Python 3.6 without changing defaults, call the executable directly:

  • To check the version:
    C:\Users\YourUsername\anaconda3\python.exe --version
    
  • To run a script:
    C:\Users\YourUsername\anaconda3\python.exe your_script.py
    

Quick Note

If you've created a dedicated Python 3.6 environment with Conda (like conda create -n py36 python=3.6), you can also activate it directly with conda activate py36—this is great if you want isolated environments for different projects.

内容的提问来源于stack exchange,提问作者Emily Johnson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:54:31