14/08/2016, 05:53
|
| | Fecha de Ingreso: agosto-2015 Ubicación: Murcia
Mensajes: 17
Antigüedad: 9 años, 3 meses Puntos: 0 | |
Error importar modulos Hola el caso es que estoy empezando a programar en python y no entiendo muy bien como va eso de los modulos, pero casi siempre estoy teniendo problemas,
este es el ultimo de ellos
-----codigo----
# -*- encoding: utf-8 -*-
from apiclient.discovery import build
import pprint
service = build("customsearch","v1", developerkey="AIzaSyCv42kIoWdrQRA5TBTriOJt6pY3wtIO 2ro")# indicamos la api customsearch y nuestra clave de desarrollador
q=raw_input("introduzca vector de busqueda(nombre): ")
recoleccion = service.cse().list(q=busqueda, cx="005744952395531099989:r-mhg05pque", num=10).execute()#creamos la varialbe recoleccion
#metemos el servicio de la api listamos una cadena (CHEE) y nuestro id de motor de busqueda creado y el numero de resultado (10)
print recoleccion.keys()
print recoleccion['items']
print recoleccion['queries']
------error-------
Traceback (most recent call last): File "C:\Users\alex_\Desktop\python\recoleccion google.py", line 3, in <module>
from googleapiclient.discovery import build ImportError: No module named apiclient.discovery
P.D:
Estos son los paquetes que he instalado para intentar que funcione
C:\Python27\Scripts>pip install urllib3
Collecting urllib3
Downloading urllib3-1.16-py2.py3-none-any.whl (98kB)
100% |################################| 102kB 636kB/s
Installing collected packages: urllib3
Successfully installed urllib3-1.16
C:\Python27\Scripts>pip install httplib2
Collecting httplib2
Downloading httplib2-0.9.2.zip (210kB)
100% |################################| 215kB 1.1MB/s
Building wheels for collected packages: httplib2
Running setup.py bdist_wheel for httplib2 ... done
Stored in directory: C:\Users\alex_\AppData\Local\pip\Cache\wheels\c7\6 7\60\e0be8ccfc1e08f8ff1f50d99ea5378e204580ea77b016 9fb55
Successfully built httplib2
Installing collected packages: httplib2
Successfully installed httplib2-0.9.2
C:\Python27\Scripts>pip install apiclient
Collecting apiclient
Downloading apiclient-1.0.3-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): urllib3 in c:\python27\lib\site-packages (from apiclient)
Installing collected packages: apiclient
Successfully installed apiclient-1.0.3 C:\Users\alex_\Downloads> c:\Python27\Scripts\pip install apiclient-1.0.3-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): apiclient==1.0.3 from file:///C:/Users/alex_/Downloads/apiclient-1.0.3-py2-none-any.whl in c:\python27\lib\site-packages Requirement already satisfied (use --upgrade to upgrade): urllib3 in c:\python27\lib\site-packages (from apiclient==1.0.3) C:\Users\alex_\Downloads> c:\Python27\Scripts\pip install --upgrade apiclient-1.0.3-py2-none-any.whl
Processing c:\users\alex_\downloads\apiclient-1.0.3-py2-none-any.whl Requirement already up-to-date: urllib3 in c:\python27\lib\site-packages (from apiclient==1.0.3) Installing collected packages: apiclient Found existing installation: apiclient 1.0.3 Uninstalling apiclient-1.0.3: Successfully uninstalled apiclient-1.0.3 Successfully installed apiclient-1.0.3
Última edición por AleXxSnJR; 14/08/2016 a las 07:15 |