DEV Community

Yizhen Zheng
Yizhen Zheng

Posted on

Conda and Python Setup for Non-ASCII Windows Usernames

Background

When your Windows username contains non-ASCII characters (Japanese, Chinese, etc.), conda cannot be installed in the default user directory path. This will cause a common conda init inside that path cannot setup terminal automatically. This guide shows how to setup conda scripts manually.

Installation Setup

1. Install Conda in ASCII-only Path

  • Install conda in a path without non-ASCII characters, such as C:\miniconda

2. Configure Conda script and PowerShell Profile

Since conda's automatic initialization may not work properly with non-ASCII usernames, you need to manually configure PowerShell:

  1. Create/edit PowerShell profile:
   notepad $PROFILE
Enter fullscreen mode Exit fullscreen mode

If the file doesn't exist, create it when prompted.

  1. Add conda initialization to the profile file:
    $ENV:PATH = "C:\miniconda\condabin;" + $ENV:PATH
    Replace C:\miniconda with your actual conda installation path.

  2. Save and restart PowerShell

  3. Set execution policy (run PowerShell as Administrator)(needed in some cases):

   Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Enter fullscreen mode Exit fullscreen mode

3. Verify Installation

After restarting PowerShell, you should see (base) in your prompt, indicating conda is active.

Environment Management

Creating and Using Virtual Environments

# Create new environment with specific Python version
conda create -n myenv python=3.12

# Activate environment
conda activate myenv

# Verify Python version
python -V

# Install packages
conda install package_name
# or
pip install package_name

# Deactivate environment
conda deactivate
Enter fullscreen mode Exit fullscreen mode

Top comments (0)