I want to uninstall Python3 and just use 2.7

720

The problem is with what is called dependencies.

Those apps depend on "python3" being installed to function properly.

You can still install any other version of python you want, but will need to specifically call that version at the command-line.

Share:
720

Related videos on Youtube

mudassir sheikh
Author by

mudassir sheikh

Updated on September 18, 2022

Comments

  • mudassir sheikh
    mudassir sheikh almost 2 years

    Following is my cascasde dropdown list query. Countries list loading up but non of the states loading up in my dropdown list. if someone can help me to rectify the query please.

            public ActionResult CountryList()
            {
    
                var countries = db.Countries.OrderBy(x=>x.CountryName).ToList(); 
            //    IQueryable countries = Country.GetCountries();
    
                if (HttpContext.Request.IsAjaxRequest())
                {
                    return Json(new SelectList(
                                countries,
                                "CountryID",
                                "CountryName"), JsonRequestBehavior.AllowGet
                                );
                }
    
                return View(countries);
            }
    
            public ActionResult StateList(int CountryID)
            {
                IQueryable <State> states= db.States. Where(x => x.CountryID == CountryID);
    
                if (HttpContext.Request.IsAjaxRequest())
                    return Json(new SelectList(
                                    states,
                                    "StateID",
                                    "StateName"), JsonRequestBehavior.AllowGet
                                );
    
                return View(states);
            }
    

    following is the View file also containg java script:

    @section scripts {
        <script type="text/javascript">
            $(function () {
                $.getJSON("/Dropdown/Countries/List",function (data) {
                    var items = "<option>---------------------</option>";
                    $.each(data, function (i, country) {
                        items += "<option value='" + country.Value + "'>" + country.Text + "</option>";
                    });
                    $("#Countries").html(items);
                });
    
                $("#Countries").change(function () {
                    $.getJSON("/Dropdown/States/List/" + $("#Countries > option:selected").attr("value"), function (data) {
                        var items = "<option>---------------------</option>";
                        $.each(data, function (i, state) {
                            items += "<option value='" + state.Value + "'>" + state.Text + "</option>";
                        });
                        $("#States").html(items);
                    });
                });
            });
        </script>
    }
    
    <h1>@ViewBag.Title</h1>
    
    @using (Html.BeginForm())
    {
        <label for="Countries">Countries</label>
        <select id="Countries" name="Countries"></select>
        <br /><br />
        <label for="States">States</label>
        <select id="States" name="States"></select>
        <br /><br />
        <input type="submit" value="Submit" />
    }
    
    • dobey
      dobey over 10 years
      Why? If you want to use 2.7 for your own code, use /usr/bin/python, though you should really be writing new code with python3.
    • dobey
      dobey over 10 years
      Yes, it is widely used. That should be pretty obvious from the apt-get remove suggesting other dependencies to be removed.
    • serhiyb
      serhiyb almost 8 years
      Can you also include your javascript code that execute ajax calls?
    • Marlon Vidal
      Marlon Vidal almost 8 years
      Call .ToList() method on your states object
    • mudassir sheikh
      mudassir sheikh almost 8 years
      IQueryable <State> states= db.States. Where(x => x.CountryID == CountryID).ToList(); ...... this code showing red line
    • Oluwafemi
      Oluwafemi almost 8 years
      What stops you from using $('#Countries').val();?
    • Developer
      Developer almost 8 years
      When you call .ToList(), that is not IQueryable, thats gonna be IEnumerable. Just use var states=
    • SDsolar
      SDsolar almost 7 years
      It is not used here. All it does is take up the limited space on my systems and backups.
    • dobey
      dobey almost 7 years
      @SDsolar Core parts of Ubuntu do require python3. If you wish to remove things and understand what you're doing, then do it. I'm not sure why you made such comments on this nearly 4 year old question.
    • SDsolar
      SDsolar almost 7 years
      Google doesn't notice the age when it puts one of these questions at the top of the list when I search. Meanwhile, I have decided to leave it be. TNX.
  • UnworthyToast
    UnworthyToast over 10 years
    Makes sense. I could swear that those apps (like rhythmbox, firefox, etc) were all installed prior to my Python3 install though, when I only had the default Python 2.7.5+ pre-installed.
  • UnworthyToast
    UnworthyToast over 10 years
    I have both 2.7 and 3 installed. I know it may not make sense to uninstall 3, it's for curiosity somewhat at this point. I can't remember why I originally wanted to. I guess I thought it was messing something on the OS up haha.
  • dobey
    dobey over 10 years
    @virtualxtc That's not exactly true. Rhythmbox depends on python >= 2.7 (but 3.0 does not satisfy that, as the package name is not python).
  • virtualxtc
    virtualxtc over 10 years
    @dobey I think what you meant to say was: "Rhythmbox depends on python >= 2.7 (but 2.7 does not satisfy that, as the package name is not python) - and thanks; I hadn't considered that.
  • dobey
    dobey over 10 years
    @virtualxtc No, I meant what I said. python is only available as python 2.x. The python 3.x package is python3. Rhythmbox in <= 13.10 cannot be installed without python 2.7 (in the default archive packages).
  • virtualxtc
    virtualxtc over 10 years
    Ok, so now I'm confused as to whether UnworthyToast's question was answered. If Rhythmbox depends on "python" >= 2.7, why using apt to remove "python3" cause it to also remove Rhythmbox? UnworthyToast - Did you have python 2.7 installed when you ran the "apt-get remove python3" command?
  • SDsolar
    SDsolar almost 7 years
    I know why I want to remove it - My Raspbian systems run from 32GB SD cards. My Ubuntu 16.04 LTS systems run on 160 GB SSD drives. It takes up a lot of space on the primary drives and in every backup. And I never use it on purpose.
  • virtualxtc
    virtualxtc almost 7 years
    @dobey @SDsolar According to the dependency list rhythmbox depends on python3 not python
  • dobey
    dobey almost 7 years
    @virtualxtc Yes. And in the nearly 4 years since the previous commentary on this question, many packaging bugs have likely been resolved, and dependencies have further changed.