Python Import Error Windows
Contents |
here for a quick overview of the site Help Center Detailed answers to
Importerror: No Module Named Site Python
any questions you might have Meta Discuss the workings and importerror no module named site python windows policies of this site About Us Learn more about Stack Overflow the company Business Learn importerror no module named site python linux more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Importerror: No Module Named Site Ubuntu
Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Python (Windows) - ImportError: No module named site up vote 57 down vote favorite 17 I am trying to install Python for the first time. I
Importerror No Module Named Site Uwsgi
downloaded the following installer from the Python website: Python 2.7.1 Windows Installer (Windows binary -- does not include source). I then ran the installer, selected 'All Users' and all was fine. I installed Python into the default location: C:\Python27 Next, to test that Python was installed correctly, I navigated to my Python Directory, and ran the "python" command in the windows cmd prompt. It returns me the following error: ImportError: No module named site When I do 'python -v' I get the following: #installing zipimport hook
import zipimport # builtin #installed zipimport hook #ImportError: No module named site #clear builtin._ #clear sys.path #clear sys.argv #clear sys.ps1 #clear sys.ps2 #clear sys.exitfunc #clear sys.exc_type #clear sys.exc_value #clear sys.exc_traceback #clear sys.last_type #clear sys.last_value #clear sys.last_traceback #clear sys.path_hooks #clear sys.path_importer_cache #clear sys.meta_path #clear sys.flags #clear sys.float_info #restore sys.stdin #restore sys.stdout #restore sys.stderr #cleanup main #cleanup[1] zipimport #cleanup[1] signal #cleanup[1] exceptions #cleanup[1] _warnings #cleanup s
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site apache importerror: no module named site About Us Learn more about Stack Overflow the company Business Learn more about
Gdb Importerror: No Module Named Site
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join importerror: no module named site mac the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up python ImportError No module http://stackoverflow.com/questions/5599872/python-windows-importerror-no-module-named-site named up vote 187 down vote favorite 32 I am very new at Python and I am getting this error: Traceback (most recent call last): File "mountain.py", line 28, in ? from toolkit.interface import interface ImportError: No module named toolkit.interface Python is installed in a local directory: My directory tree is like this: (local directory)/site-packages/toolkit/interface.py My code is in here (local directory)/site-packages/toolkit/examples/mountain.py To run the example http://stackoverflow.com/questions/338768/python-importerror-no-module-named I do python mountain.py, and in the code I have: from toolkit.interface import interface And i get the error that I wrote, I have already checked sys.path and there I have the directory /site-packages, also I have the file __init__.py.bin in the toolkit folder to indicate to Python that this is a package. I also have a __init__.py.bin in the examples directory. I do not know why Python cannot find the file when it is in sys.path, any ideas? Can be a permissions problem? Do I need execution permission? python importerror python-import share|improve this question edited Jul 8 at 17:00 OmarOthman 94621126 asked Dec 3 '08 at 21:26 Eduardo 4,245164567 1 @S.Lott: indeed the original question said init.py.bin, maybe that's the whole point... (?) –Federico A. Ramponi Dec 3 '08 at 21:33 @Federico Ramponi: I just formatted it. I didn't try to answer it. –S.Lott Dec 3 '08 at 21:46 @S. Lott Another problem that was confuising me was to have two installations one did by the root and another one did by me –Eduardo Jan 7 '09 at 5:45 I'm having the same ImportError: problem,
started with python -I had a hard time figuring out how to import third-party modules & packages into my program. Here's a gist of what I finally learnt: Know the Python Path Knowing http://knowpapa.com/import/ about the PYTHONPATH is key to installing and importing third-party packages. When an import command is passed, python looks for the module/package in a list of places. The default path(s) where python would search for modules can be found out by: import sys print sys.path For my computer it gives me the the following paths: [", ‘C:\\Python27\\Lib\\idlelib', ‘C:\\Windows\\system32\\python27.zip', ‘C:\\Python27\\DLLs', ‘C:\\Python27\\lib', ‘C:\\Python27\\lib\\plat-win', ‘C:\\Python27\\lib\\lib-tk', ‘C:\\Python27', ‘C:\\Python27\\lib\\site-packages'] Starters would no module do good to install or add modules in one of these paths. If you get this wrong, you will get an error like: ImportError: No module named "foo" . By convention, all third-party packages go into Pythonfolder/Lib/site-packages. Importing Module or Importing packages ? When you add a third-party module to your python library, remember that simply dumping a folder with bunch of .py files will not make no module named it a package. When you use the import command, python does not look inside folders, even if the folders are located in the PYTHONPATH. However, if a folder in the PythonPath has a file called __init__.py, Python jumps inside it and treats the complete folder as a package. Changing the Pythonpath If you want to add packages in any other directory (other than the python paths listed above) - you will have to first export the python path in your code with: PYTHONPATH=$PYTHONPATH:C/Your new path/yournewmodulefolder Virtual Environment Builder Suppose you build several applications in your Python environment where one of your application requires version 1 of PackageX, while another application of yours requires version 2 of PackageX. If you try placing both these version in the same folder (say site-package), you are in for some trouble. To avoid any such interference, you can have separate Virtual environment for each of your applications using Virtual Python Environment builder. Possibly RelatedOpen Source Android App to Calculate Sunrise Sunset TimeAndroid: Adding Glow Effect to UI elementsOpenCV: Interlacing Two ImagesOpenCV:Convert an Image to GreyScaleOpenCV: Split target image into its red, green and blue channelsAndroid Gesture Detector DemoDownload All Images from a Remote Dire