0

I am new to python just a few weeks back i started using python(Classic Noob-Disclaimer) Now whenever i install a module by copying the unzipped folder in site-packages under Lib and running the source install by using "c:\python27\lib\site-packages\tweepy-1.2\setup.py install" in command prompt it installs without any errors. But now when i make a python script (*.py) and store it on the desktop it wont work and it gives out an error "No module found" but when i store it in the same folder as the source it works perfectly. also if i open the IDLE GUI it also returns the same error. But this doesnt happen with the win32com module which i use for TTS. I missing something..but i cudnt find the answer to it. Plz help me! i need to use many of these modules..they work great differently but not together as the modules are always missing!

  • Can you paste exactly the error msg, the import statement that causes the error, and sys.path contents (python -c "import sys; print sys.path)" – dahpgjgamgan Sep 29 '12 at 18:31
  • When you unpack/unzip a source distribution you don't put it in the site-packages directory yourself. Put it anywhere else, such as your home folder. Then you run the `setup install`, which will copy the files itself into site-packages directory, in the proper package structure. In your case, your Python may be getting confused by the source tree it is finding there. – Keith Sep 29 '12 at 19:28

3 Answers3

1

Copying an unzipped folder to site-packages does not install a Python package.

To install manually, unzip the package to a temporary directory, then run:

python setup.py install

in this directory, after that you can remove the directory.

To download and install a pure Python package automatically, run:

pip install tweepy

if you have pip installed.

The simplest way to install Python packages that have C extensions is to use binary installers (*.exe, *.msi files).

jfs
  • 399,953
  • 195
  • 994
  • 1,670
0

To avoid all this use VirtualEnv

Virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded. Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application. Also, what if you can't install packages into the global site-packages directory? For instance, on a shared host.

Pratik Mandrekar
  • 9,362
  • 4
  • 45
  • 65
0

The easiest way to install python packages is by using pip. First you need to install pip as explained here if you use windows. Then you can query some packages, from command line, for example

> pip search twitter

Then to install certain packages, just use pip something like this:

> pip install tweepy
Community
  • 1
  • 1
pram
  • 1,484
  • 14
  • 17