[Python] Creation of Virtual environment with python 3.9 version is executed successfully but...

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    When creating a virtual environment using the 'virtualenv' module, using python 3.11 as deafult/ in the Path, in WINDOWS 10 , I encounter the following weird error. Creation of a virtualenvironment with python 3.9 which is installed in "E:\python33\python.exe" is successful, but creation of virtual environment with python python 2.2 or 2.7 which is also installed in "E:\python27\python.exe" fails. Following are the errors shown in command prompt.

    C:\Users\abc\Desktop>virtualenv -p E:\python27\python.exe tl343f
    RuntimeError: failed to query E:\python27\python.exe with code 1 err: ' File "C:\\Users\\abc\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\virtualenv\\discovery\\py_info.py", line 24\n return list(OrderedDict.fromkeys(["", *os.environ.get("PATHEXT", "").lower().split(os.pathsep)]))\n ^\nSyntaxError: invalid syntax\n'

    C:\Users\abc\Desktop>virtualenv -p E:\python33\python.exe kljkj33
    created virtual environment CPython3.9.12.final.0-64 in 738ms
    creator CPython3Windows(dest=C:\Users\abc\Desktop\kljkj33, clear=False, no_vcs_ignore=False, global=False)
    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\abc\AppData\Local\pypa\virtualenv)
    added seed packages: pip==23.2.1, setuptools==68.2.0, wheel==0.41.2
    activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

    C:\Users\abc\Desktop>


    I am expecting the code to execute similar to how it executes when I want to create a virtual environment with python3.9 version. But it fails when creating a virtual environment with python2.7 or python2.2 version

    Continue reading...

Compartilhe esta Página