Upgrading Python with Conda: A Comprehensive Guide from 3.5 to 3.6

Nov 03, 2025 · Programming · 12 views · 7.8

Keywords: Python upgrade | Conda environment management | Dependency conflict resolution | Anaconda | Virtual environments

Abstract: This article provides a detailed guide on upgrading Python from version 3.5 to 3.6 in Anaconda environments, covering multiple methods including direct updates, creating new environments, and resolving common dependency conflicts. Through in-depth analysis of Conda package management mechanisms, it offers practical steps and code examples to help users safely and efficiently upgrade Python versions while avoiding disruption to existing development environments.

Necessity of Python Version Upgrade

Python 3.6 introduced several significant features, with formatted string literals (f-strings) being the most notable enhancement that greatly simplifies string formatting operations. F-strings allow embedding expressions directly within strings, making code more concise and readable compared to traditional .format() methods or % formatting. For example:

name = "Alice"
age = 30
# Traditional method
print("Name: {}, Age: {}".format(name, age))
# F-strings method
print(f"Name: {name}, Age: {age}")

Beyond f-strings, Python 3.6 also introduced asynchronous generators, asynchronous comprehensions, variable type annotations, and other improvements that make coding more efficient and modern.

Fundamentals of Conda Environment Management

Conda is an open-source package management and environment management system that easily handles multiple Python versions and dependencies. In Conda, Python is treated as a regular package, meaning different Python versions can be installed and managed like any other package.

To view available Python versions in the current environment, use the following command:

conda search python

This command lists all packages containing the text "python". For exact package name matching, add the --full-name option:

conda search --full-name python

Anaconda supports multiple Python versions including 2.7, 3.4, 3.5, and 3.6, with specific available versions depending on the installed Anaconda version and configured channels.

Method 1: Direct Python Update

For minor version updates (such as from 3.5.2 to the latest 3.5.x version), a simple update command can be used:

conda update python

This command updates Python to the latest available version in the current branch. To update Conda itself to ensure proper package management functionality, run:

conda update conda

For cross-major version upgrades (such as from 3.5 to 3.6), a more specific installation command is required:

conda install python=3.6

This method installs the specified Python version directly in the current environment but may encounter dependency conflicts, particularly in newer Conda versions.

Method 2: Creating New Environment (Recommended)

Creating a new isolated environment represents the best practice for upgrading Python versions, as this approach doesn't affect existing projects and dependencies. The command to create a new environment is:

conda create --name py36 python=3.6

Here, the --name parameter specifies the new environment name (using py36 in this case), and python=3.6 specifies the Python version to install. After creation, activate the new environment using:

conda activate py36

To verify the new environment uses the correct Python version, run:

python --version

If the complete Anaconda distribution needs installation during environment creation, use:

conda create -n py36 python=3.6 anaconda

Obtaining Latest Python Version

To install specific minor versions (such as Python 3.6.5), access them through the conda-forge channel:

conda create --name py365 python=3.6.5 --channel conda-forge

Conda-forge is a community-maintained Conda channel that typically provides newer package versions than official channels. The --channel parameter specifies installation from particular channels.

Dependency Conflict Analysis and Resolution

In newer Conda versions (such as 4.11.0), installing older Python versions may encounter dependency conflicts. This primarily occurs because newer Conda versions and their dependencies typically require newer Python versions and system libraries.

Common conflicts include:

When encountering UnsatisfiableError, consider these solutions:

  1. Use older Conda versions (such as 4.10.3)
  2. Create fresh Miniconda installations
  3. Use virtual environments instead of Conda environments
  4. Compile Python from source code

Environment Switching and Management

Switching between different Python versions is straightforward. To switch to the newly created Python 3.6 environment:

conda activate py36

To return to the base environment or other environments:

conda deactivate
conda activate base  # or other environment names

To view all available environments:

conda env list

To remove environments no longer needed:

conda env remove --name py36

Best Practice Recommendations

Based on practical experience and community feedback, the following best practices are recommended:

By following these guidelines, Python version upgrade processes can proceed smoothly while maintaining development environment stability and maintainability.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.