skip to Main Content

I want to create virtual environment using python 3.9.15 version. It will get the global version of python but not that version in virtual environment. can you suggest me solution for that

I tried to do using venv and virtualenv but it didn’t work.

2

Answers


  1. You could try using pipenv, it works predictably for me (and for my team)

    https://pypi.org/project/pipenv/

    A sample Pipfile looks like this

    [[source]]
    url = "https://pypi.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [packages]
    fastapi = {extras = ["httpx"], version = "==0.92.0"}
    uvicorn = {extras = ["standard"], version = "==0.20.0"}
    pydantic = "==1.10.4"
    
    
    [dev-packages]
    invoke = "==1.4.1"
    
    
    [requires]
    python_version = "3.9"
    python_full_version = "3.9.15"
    

    You need to create a Pipfile with the version of Python that you want in your project directory, and then run
    pipenv install

    This will install the virtual env with the Python version that you specified and all the packages in the file.

    Then you can access the virtual environment shell by using pipenv shell.

    You can read more in their docs: https://pipenv.pypa.io/en/latest/

    Login or Signup to reply.
  2. C:UserskiranAppDataLocalProgramsPythonPython39python.exe -m venv venv 
    

    You have to go to the path of python 3.9.15 version copy that path(in my case C:UserskiranAppDataLocalProgramsPythonPython39 this is the path, after that add python.exe -m venv venv , It will create virtual environment with the python version 3.9.15

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search