- 1 year ago
Python 3.7 - activate venv error Parameter format not correct 65001 WINDOWS
The error message "Parameter format not correct 65001" on Windows usually occurs when trying to activate a Python virtual environment (venv) using the activate
script, and it's related to the encoding of the command prompt.
The error is often associated with setting the default code page of the command prompt to UTF-8 (code page 65001) using the following command:
bashchcp 65001
While setting the code page to UTF-8 can be helpful for displaying Unicode characters correctly, it can cause issues with certain Python scripts, including the activate
script used to activate virtual environments.
To resolve the issue, you can try the following solutions:
Remove the UTF-8 Code Page Setting:
Open a new command prompt and avoid runningchcp 65001
before activating the virtual environment. Theactivate
script should work without the code page set to UTF-8.Use a Fresh Command Prompt:
If you've already set the code page to UTF-8 in the current command prompt session, close the current command prompt and open a fresh one. The new command prompt should not have the UTF-8 code page setting.Use PowerShell:
Instead of using the traditional Command Prompt, try using PowerShell to activate the virtual environment. PowerShell handles Unicode and UTF-8 encoding differently and might not encounter the same issue. To activate the virtual environment in PowerShell, use the following command:bash.\venv\Scripts\Activate
Replace
venv
with the name of your virtual environment directory.Use the Absolute Path to the venv:
If you encounter the error when activating the virtual environment with a relative path, try using the absolute path to theactivate
script. For example:bashC:\path\to\venv\Scripts\Activate
Replace
C:\path\to\venv
with the actual absolute path to your virtual environment.
By following one of these solutions, you should be able to activate your Python virtual environment without encountering the "Parameter format not correct 65001" error on Windows.