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

如何同步Visual Studio中Python36_64与Anaconda3_64的包版本?

Sync and Update Python Packages Across VS2017's Python36_64 and Anaconda3_64 Environments

Hey there! Let's walk through how to sync and upgrade the packages in both your standalone Python 3.6 and Anaconda 3.6 environments set up via Visual Studio 2017. Since these are two separate environments, we'll need to target each one explicitly to avoid mixing up their tools and packages.

Step 1: Upgrade pip in Both Environments First

First, make sure the pip tool itself is up-to-date in both environments—this prevents issues during package upgrades.

  • For the Python36_64 environment, open Command Prompt or PowerShell and run:

    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" -m pip install --upgrade pip
    
  • For the Anaconda3_64 environment, run:

    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\python.exe" -m pip install --upgrade pip
    

Step 2: Sync Package Lists Between Environments

Pick one environment as your "source" (whichever has the package set you prefer), export its package list, then install and upgrade those packages in the other environment.

Option A: Use Python36_64 as the source

  1. Export Python36_64's package list to a text file:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" -m pip freeze > python_packages.txt
    
  2. Install and upgrade these packages in Anaconda3_64:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\python.exe" -m pip install --upgrade -r python_packages.txt
    

Option B: Use Anaconda3_64 as the source

  1. Export Anaconda3_64's package list to a text file:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\python.exe" -m pip freeze > anaconda_packages.txt
    
  2. Install and upgrade these packages in Python36_64:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" -m pip install --upgrade -r anaconda_packages.txt
    

Step 3: Upgrade All Packages to the Latest Versions

After syncing, ensure every package in both environments is at its latest compatible version (note: Python 3.6 is end-of-life, so some newer packages may no longer support it—you'll see warnings for these).

For Command Prompt:

  • Upgrade all packages in Python36_64:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" -m pip freeze | findstr /v "^-e" | cut -d = -f 1 | xargs -n1 pip install --upgrade
    
  • Upgrade all packages in Anaconda3_64:
    "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\python.exe" -m pip freeze | findstr /v "^-e" | cut -d = -f 1 | xargs -n1 pip install --upgrade
    

For PowerShell:

  • Upgrade all packages in Python36_64:
    Get-Content python_packages.txt | ForEach-Object { $_.Split('==')[0] } | ForEach-Object { & "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe" -m pip install --upgrade $_ }
    
  • Upgrade all packages in Anaconda3_64:
    Get-Content anaconda_packages.txt | ForEach-Object { $_.Split('==')[0] } | ForEach-Object { & "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\python.exe" -m pip install --upgrade $_ }
    

Quick Note on Anaconda

If you prefer using Anaconda's native conda tool instead of pip for the Anaconda environment, you can run conda update --all in that environment (just make sure to use the Anaconda conda path: "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts\conda.exe" update --all). But using pip across both environments keeps the process consistent.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 06:26:23