importerror: No module named django in windows 7 - python

I have looked into post with the same problem as mine but never got lucky to find solution of mine. I have installed python 3.4.1 and and install django through git. I have also set my environment variable PATH to C:\Python34\Scripts but everytime I type django-admin --version in my command promt, it says not recognize as internal or external command and when using python shell when I type import django it says importerror: No module named django. What am I missing here? Please help. Thanks a lot.

Related

AttributeError: module 'collections' has no attribute 'Iterator'

I'm diving into a Django docs and I'm using the latest Django (4.0.4) and Python 3.10.0
Whenever I try the command django-admin startproject mysite it gives the error "AttributeError: module 'collections' has no attribute 'Iterator'"
I am using a virtual environment as well which has the Django installed on it.
I tried uninstalling the django and reinstalling but no changed in the program..
Please guide me into the right direction.
Thank you!
Django 4.0.4 was just released few days back.
You know, django-admin is a Python script that gets added to your PATH variable so that it's invocable from the command line with django-admin (as opposed to something like python3 -m django_admin) maybe there was an older version lurking around your PATH that reinstalling will help you fix
or
Use an older version of Python (Django 2.x, as used by that project supports up to Python 3.7).

Tweet a message using python

i am a newbie in Python and want to try to tweet using python using this code, but after i run it, in python shell said that
from twython import Twython
ModuleNotFoundError: No module named 'twython'
Can someone help what's wrong with my code?
Welcome to Python family! When a module is first imported, Python searches for the module and if found, it creates a module object, initializing it. If the named module cannot be found, a ModuleNotFoundError is raised.
As a beginner, you should learn how to install a package in Python by going through the tutorial: https://packaging.python.org/tutorials/
Next, you should follow the installation guide in
https://twython.readthedocs.io/en/latest/usage/install.html
In the command prompt, you should run
pip install twython
Observe if any error pops up during the installation.
To see if Twython works correctly, start Python in the command prompt,
python
In the Python environment, run the following command:
>>> from twython import Twython
If Twython is installed correctly, you should not see the ModuleNotFoundError.
ModuleNotFoundError means that the module is not installed. Sometimes may be the module is installed but it is installed in a place where python does not look for it. In your case I feel you have not installed twython.
Open command prompt and type the following command
pip install twython
This should install the twython and after this if you run your file the error will not appear.
Check this out for more information on twython https://pypi.org/project/twython/
Firstly, you should try again pip install command,
Also:
If you are using an different place such as Pycharm or Jupyter or Anaconda, you must reinstall that module in that working environments
If you are using python's own ide, try add your current python path to system path
Re-read usage of your module

Python-Django: ImportError: no module named django

Im completely new to django and Ive been trying to set up an environment from here [https://docs.djangoproject.com/en/1.1/intro/tutorial01/]. Python was already setup on my mac
Python 2.7.2. I followed the instructions and setup django using
sudo port install py27-django
And also added /etc/paths.d/macports with
/opt/local/bin
/opt/local/sbin
/opt/local/lib/python2.7/site-packages/django/bin
But I still get the ImportError: No module named django message when I import django from the python shell.
I looked at this link
importerror: No module named django but it didnt really help much. Any help is appreciated
Have a look at this article... they are using virtualenv to set up the project and this fixed a lot of problems like this for me. With virtualenv, the system libraries and the libraries you need for your python project are separated, so your not mangling them together.
http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/
If I may, it looks like the last path you added was pointing to a python2.4 directory, you might need to look for django in a python2.7 directory instead.

Running django-admin.py startproject is giving me an error

I've just started looking into python and django.. Im pretty sure ive successfull installed both python and the django framework and i managed to add python and django-admin.py to my system path but now when i run the command django-admin.py startproject My_Test_Site, in the folder i want to create a new project directory in (just following the tutorials), i get the following error:
What am i doing wrong?
This is not a Django error. It appears it cannot find the Python module unicodedata which is part of the Python Standard Library (docs). I see that there is also a bug report about this issue (Python 2.7 on Windows, see here). On the other hand, some people there report that reinstalling their Python installation fixed the problem. You could give that a try.
notice the last line, it says import unicodedata, importError
im guessing you probably didnt install your django properly.
so reinstall it and check that django is in your "path", i believe django does this automatically when it installs but doesnt hurt to double check.
if reinstalling django still doesn't work, i suggest you uninstall python and django related stuff.
then install python, install pip, then use pip install django.

Why do I get a Django-userena installation ImportError?

I am using Ubuntu with Python and Django already installed.
I installed django-userena by pip.
The docs at django-userena.org say to add 'userena', 'guardian', 'easy_thumbnails' to the INSTALLED_APPS in the setting files, but, after doing so, when I try to run the server it gives an import error, "no module named userena"
I also tried importing userena in the Python shell, but it gives an error too.
INSTALLATION : http://docs.django-userena.org/en/latest/installation.html#required-settings

Categories