2012-02-03 14 views
10
$ sudo pip install bottle 
Downloading/unpacking bottle 
    Downloading bottle-0.10.7.tar.gz (55Kb): 55Kb downloaded 
    Running setup.py egg_info for package bottle 
Installing collected packages: bottle 
    Found existing installation: bottle 0.10.7 
    Uninstalling bottle: 
     Successfully uninstalled bottle 
    Running setup.py install for bottle 
    changing mode of build/scripts-2.6/bottle.py from 640 to 755 
    changing mode of /usr/local/bin/bottle.py to 755 
Successfully installed bottle 

>>> help('modules') 
blahblah 
bottle 
blahblah 

$ ls /usr/local/lib/python2.6/dist-packages/ 
bottle-0.10.7.egg-info bottle.py bottle.pyc 

peroImportError: Sin módulo denominado botella

$ python 
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) 
[GCC 4.4.5] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import bottle 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named bottle 

wtf ??? Ubuntu 10.10

SOLUCIÓN: # chmod -R 775 /usr/local/lib/python2.6/dist-packages/ es ayuda para mí. Gracias por todo.

+1

¿Qué significa 'el cual python' decir? –

+0

/usr/bin/python – strangeman

+0

¿Qué es 'sys.path'? – jfs

Respuesta

2

Lo que terminó trabajando para mí fue:

chmod -R 775 /usr/local/lib/python2.6/dist-packages/ 
1

Se recomienda que utilice un virtualenv con python en general, pero diría especialmente con el desarrollo web.

¿Qué sucede cuando utiliza un virtualenv?

$ sudo pip install virtualenv virtualenvwrapper 
$ sudo cat >> ~/.bashrc << EOF 
# virtualenvwrapper setup 
export WORKON_HOME=~/.virtualenvs 
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages --python=python2.6' 
source /usr/local/bin/virtualenvwrapper.sh 
EOF 
$ source ~/.bashrc 
$ mkvirtualenv test 
$ pip install bottle 
$ python 
>>> import bottle 

Porque me sale esto:

$ python 
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) 
[GCC 4.5.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import bottle 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named bottle 
>>> 

$ mkvirtualenv test 
Running virtualenv with interpreter /usr/bin/python2.6 
New python executable in test/bin/python2.6 
Also creating executable in test/bin/python 
Please make sure you remove any previous custom paths from your /home/hughdbrown/.pydistutils.cfg file. 
Installing setuptools.............................done. 
Installing pip...............done. 
virtualenvwrapper.user_scripts creating /home/hughdbrown/.virtualenvs/test/bin/predeactivate 
virtualenvwrapper.user_scripts creating /home/hughdbrown/.virtualenvs/test/bin/postdeactivate 
virtualenvwrapper.user_scripts creating /home/hughdbrown/.virtualenvs/test/bin/preactivate 
virtualenvwrapper.user_scripts creating /home/hughdbrown/.virtualenvs/test/bin/postactivate 
virtualenvwrapper.user_scripts creating /home/hughdbrown/.virtualenvs/test/bin/get_env_details 

$ pip install bottle 
Downloading/unpacking bottle 
    Downloading bottle-0.10.7.tar.gz (55Kb): 55Kb downloaded 
    Running setup.py egg_info for package bottle 
Installing collected packages: bottle 
    Running setup.py install for bottle 
    changing mode of build/scripts-2.6/bottle.py from 644 to 755 
    changing mode of /home/hughdbrown/.virtualenvs/test/bin/bottle.py to 755 
Successfully installed bottle 
Cleaning up... 

$ python 
Python 2.6.6 (r266:84292, Mar 25 2011, 19:24:58) 
[GCC 4.5.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import bottle 
>>> 
+0

Rastreo (llamada más reciente pasado): Archivo "", línea 1, en ImportError: Sin módulo denominado virtualenvwrapper.hook_loader virtualenvwrapper.sh: Hubo un problema al ejecutar los ganchos de inicialización. Si Python no pudo importar el módulo virtualenvwrapper.hook_loader, verifique que virtualenv se haya instalado para VIRTUALENVWRAPPER_PYTHON =/usr/bin/python y que PATH esté configurado correctamente. – strangeman

+0

Creo que necesito eliminar todo: pip, virtualenv, bottle, etc., y volver a instalarlos. :) – strangeman

+0

Sí, tiene que agregar a su ~/.bashrc: 'export WORKON_HOME = ~/.virtualenvs source/usr/local/bin/virtualenvwrapper.sh' – hughdbrown

0

Sé que voy tarde a la fiesta - pero yo estaba teniendo un problema con el comando python y mi módulo bottle.py se encuentra en mi 3. x lib directorio.

acabo arrojó un enlace simbólico desde bottle.py en mi python3.x a mi directorio actual 2.x como tal:

sudo ln -s ~/.local/lib/python3.5/site-packages/bottle.py /usr/local/lib/python2.7/dist-packages/bottle.py 

cambiar Obviamente los números de versión para que coincida con la estructura de directorios!

0

Recibo este error en Windows Environment.

satisfaga tienen mirada hacia el siguiente:

C:\Python27>python Redirect_URL.py 
Traceback (most recent call last): 
    File "Redirect_URL.py", line 17, in <module> 
    from bottle import get, request, static_file, run 
ImportError: No module named bottle 
+0

Si tiene una pregunta nueva, hágalo haciendo clic en el botón [Preguntar pregunta] (https://stackoverflow.com/questions/ask). Incluye un enlace a esta pregunta si ayuda a proporcionar contexto. - [De la opinión] (/ reseña/mensajes de baja calidad/18237911) – YowE3K

Cuestiones relacionadas