Todavía estoy intentando instalar Flask en los ‘entornos virtuales’. Tuve algunos errores al intentar obtener los comandos pip cuando se activaba virtualenv. (tuve algo que hacer que mi nombre de usuario tiene un espacio en el nombre) Pero finalmente encontré una solución, simplemente escriba la ruta correcta hacia donde se encuentra pip, para evitar la carpeta de nombre de usuario.
(venv) C:\Users\Daniel PC>cd C:\Python34\Scripts (venv) C:\Python34\Scripts>pip Usage: pip [options] etc...
Bueno al intentar instalar el matraz me salen los siguientes errores.
(venv) C:\Python34\Scripts>pip install flask Downloading/unpacking flask Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P -C\flask\setup.py) egg_info for package flask warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' no previously-included directories found matching 'docs\_themes\.git' Downloading/unpacking Werkzeug>=0.7 (from flask) Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P -C\Werkzeug\setup.py) egg_info for package Werkzeug warning: no files found matching '*' under directory 'werkzeug\debug\templat es' warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' Downloading/unpacking Jinja2>=2.4 (from flask) Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P -C\Jinja2\setup.py) egg_info for package Jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'do cs\_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Downloading/unpacking itsdangerous>=0.21 (from flask) Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P -C\itsdangerous\setup.py) egg_info for package itsdangerous warning: no previously-included files matching '*' found under directory 'do cs\_build' Downloading/unpacking markupsafe (from Jinja2>=2.4->flask) Downloading MarkupSafe-0.23.tar.gz Running setup.py (path:C:\Users\DANIEL~1\AppData\Local\Temp\pip_build_Daniel P -C\markupsafe\setup.py) egg_info for package markupsafe Installing collected packages: flask, Werkzeug, Jinja2, itsdangerous, markupsafe Running setup.py install for flask warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' no previously-included directories found matching 'docs\_themes\.git' Running setup.py install for Werkzeug warning: no files found matching '*' under directory 'werkzeug\debug\templat es' warning: no files found matching '*' under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs\_build' Running setup.py install for Jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'do cs\_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Running setup.py install for itsdangerous warning: no previously-included files matching '*' found under directory 'do cs\_build' Running setup.py install for markupsafe building 'markupsafe._speedups' extension ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Failure information, if any, is above. Retrying the build without the C extension now. ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Plain-Python installation succeeded. ========================================================================== Successfully installed flask Werkzeug Jinja2 itsdangerous markupsafe Cleaning up...
dice que ha instalado correctamente el flask, pero cuando ejecuta Python y trata de escribir el flask de importación, ¿parece que no está instalado? ¿Que puedo hacer?
(venv) C:\Python34\Scripts>python Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import flask Traceback (most recent call last): File "", line 1, in ImportError: No module named 'flask'
Estoy por cierto corriendo en Windows 7
Para que un módulo / paquete sea instalado por pip
en virtualenv, debe usar el pip
de virtualenv.
Para importar módulos / paquetes que se están instalando en el entorno virtualenv, debe ejecutar el intérprete de python
desde virtualenv dado.
En caso de que ejecute su pip
o python
desde el directorio C:\Python 34\Scripts
, es muy probable que use pip
todo el sistema e instale el flask
en el sistema Python. En Linux, si tiene problemas, la instalación en Python de todo el sistema requiere privilegios de root, en la instalación de Python predeterminada de MS Windows no se queja.
Consejo: Cree su virtualenv fuera del directorio de instalación de Python predeterminado y use pip
y python
de esta virtulaenv. Esto es lo que suele ocurrir cuando se activa el virtualenv, por lo que no es necesario usar explícitamente la ruta completa para pip
o python
(de todos modos, usar la ruta explícita para venv python
y pip
no dañaría nada).
Tuve exactamente el mismo problema que tú, y la respuesta de Jan no me funcionó.
El problema fue simplemente que instalé virtualenv usando apt-get:
$ sudo apt-get install virtualenv
En lugar de instalarlo con pip:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ sudo python get-pip.py $ sudo pip install virtualenv
Me solucionó el problema. Incluso puedes desinstalar el paquete apt-get después de:
$ sudo apt-get remove virtualenv
virtualenv
todavía está instalado (pero el bueno!).
¿Añadiste python a tu camino?
Prueba esto: