Re: [Tutor] I think I've broken my Python
What about installing or reinstalling Django using the python version that produced the error message? On Mon, Nov 12, 2018 at 10:10 AM Matthew Ngaha wrote: > > On Mon, Nov 12, 2018 at 3:31 PM Mats Wichmann wrote: > > > > Reconstruct the virtualenv you want maybe? Their whole concept is that > > they're cheap and easy and can just be thrown away. Of course, you then > > have to remember what you did to create it in order to make a new one... > > It's been 3 years, I'm clueless as to how I created it. Also I'm a > noob when it comes to Linux which makes this even more confusing for > me. The 3 years I've been absent from Programming I went back to > Windows. > > > Since you're on a Linux platform, use "which" to see how the names you > > are typing are resolving > > > > which python > > which python3 > > The "command" gives this output: > > (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> > which python > /usr/bin/python > (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> > which python3 > /usr/bin/python3 > > > Usually if the virtualenv has been broken by external factors, it won't > > even activate. Are you sure you remembered to try to activate it? > > > Yep, I double checked to make sure I remembered to try to activate it. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I think I've broken my Python
On 11/12/18 10:07 AM, Matthew Ngaha wrote: > On Mon, Nov 12, 2018 at 3:31 PM Mats Wichmann wrote: >> >> Reconstruct the virtualenv you want maybe? Their whole concept is that >> they're cheap and easy and can just be thrown away. Of course, you then >> have to remember what you did to create it in order to make a new one... > > It's been 3 years, I'm clueless as to how I created it. Also I'm a > noob when it comes to Linux which makes this even more confusing for > me. The 3 years I've been absent from Programming I went back to > Windows. > >> Since you're on a Linux platform, use "which" to see how the names you >> are typing are resolving >> >> which python >> which python3 > > The "command" gives this output: > > (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> > which python > /usr/bin/python > (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> > which python3 > /usr/bin/python3 > >> Usually if the virtualenv has been broken by external factors, it won't >> even activate. Are you sure you remembered to try to activate it? >> > Yep, I double checked to make sure I remembered to try to activate it. > it's possible there was never a virtualenv involved... on a Linux system you'd normally install the distribution package for django, instead of installing bits in a virtualenv. The distro package contains a template manage.py. Which, on a current Fedora, contains wording suggesting maybe a virtualenv wasn't started - but the real message is that it couldn't find necessary Django pieces in the python environment (this is consistent with your original message, suggesting it found and is running manage, but other things are missing). Here's the interesting part of the content of that template for those who might have more ideas: if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I think I've broken my Python
On Mon, Nov 12, 2018 at 3:31 PM Mats Wichmann wrote: > > Reconstruct the virtualenv you want maybe? Their whole concept is that > they're cheap and easy and can just be thrown away. Of course, you then > have to remember what you did to create it in order to make a new one... It's been 3 years, I'm clueless as to how I created it. Also I'm a noob when it comes to Linux which makes this even more confusing for me. The 3 years I've been absent from Programming I went back to Windows. > Since you're on a Linux platform, use "which" to see how the names you > are typing are resolving > > which python > which python3 The "command" gives this output: (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> which python /usr/bin/python (website) matthew@linux-oq68:~/Documents/mywork/web/website/blogsite> which python3 /usr/bin/python3 > Usually if the virtualenv has been broken by external factors, it won't > even activate. Are you sure you remembered to try to activate it? > Yep, I double checked to make sure I remembered to try to activate it. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I think I've broken my Python
On 11/12/18 4:45 AM, Matthew Ngaha wrote: > I haven't coded in about 3 years and I used to use Python3.4 on > openSUSE13.1. I had a virtual environment with this Python for a > development Django website. Before I stopped coding, I upgraded to > Python3.5, but everything still worked if I remember correctly. But > now I'm back to coding I tried to load up my Django website but I get > the error: > Traceback (most recent call last): > File "manage.py", line 8, in > from django.core.management import execute_from_command_line > ImportError: No module named django.core.management > > What happens is Django's manage.py can't be found so the line: > "from django.core.management import execute_from_command_line" > throws the error. In the virtual environment when I type python in the > command line, it opens Python2.7 and when I type Python3, it opens > Python3.5. So it seems my Python3.4 is lost. I thought the virtual > environment only loaded up the Python version it was installed for, in > my case Python3.4 when I type python or python3 in the command line, > had I known this wasn't the case I would have never upgraded Python. > Is there anything I can do? Reconstruct the virtualenv you want maybe? Their whole concept is that they're cheap and easy and can just be thrown away. Of course, you then have to remember what you did to create it in order to make a new one... Virtualenv *can* make a full copy of the Python environment you are building it from, but does not by default - it uses links to save space if the platform is okay with that. That does mean that if the original goes away due to version upgrade, you're likely to be left with an unusable virtualenv (see the --always-copy argument to virtualenv). Since you're on a Linux platform, use "which" to see how the names you are typing are resolving which python which python3 Usually if the virtualenv has been broken by external factors, it won't even activate. Are you sure you remembered to try to activate it? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] I think I've broken my Python
I haven't coded in about 3 years and I used to use Python3.4 on openSUSE13.1. I had a virtual environment with this Python for a development Django website. Before I stopped coding, I upgraded to Python3.5, but everything still worked if I remember correctly. But now I'm back to coding I tried to load up my Django website but I get the error: Traceback (most recent call last): File "manage.py", line 8, in from django.core.management import execute_from_command_line ImportError: No module named django.core.management What happens is Django's manage.py can't be found so the line: "from django.core.management import execute_from_command_line" throws the error. In the virtual environment when I type python in the command line, it opens Python2.7 and when I type Python3, it opens Python3.5. So it seems my Python3.4 is lost. I thought the virtual environment only loaded up the Python version it was installed for, in my case Python3.4 when I type python or python3 in the command line, had I known this wasn't the case I would have never upgraded Python. Is there anything I can do? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor