Last active
January 1, 2019 17:36
-
-
Save dantejauregui/dcd23f5abb0371cb89634eab2b591a1d to your computer and use it in GitHub Desktop.
Virtualenv use for Python v2.7 (se debe usar para ML: Keras, etc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.-After install pyenv with: pip install virtualenv | |
2.-select the folder of the project where you wanna create the vEnv. | |
3.-in terminal run this: | |
virtualenv pyEnv2.7 -p /usr/bin/python2.7 | |
"pyEnv27" is the name of the virtualEnv Folder | |
and | |
"-p /usr/bin/python2.7" is the specific route where python2.7 is located natively in MAC | |
4.-start the vEnv: | |
Para iniciar el vEnvironment (se debe hacer en la carpeta padre donde esta el file vEnv): | |
"source (nombre del folder que cree: DANTE)/bin/activate" | |
5.- en caso quiero salir del vEnv (dentro del vEnv): | |
"deactivate" | |
6.- y si quiero eliminarlo (voy al father folder del vEnv y elimino): | |
"rm -rf (nombre de folder)" o "rm -rd (nombre de folder)" ??? | |
**una vez que estemos dentro del virtualenv, todas las dependencias que instalemos se instalaran con la libreria "PIP" (nunca PIP3), por ej para instalar Jupyter Notebook dentro de virtualEnv: | |
7.-Revisar la version de PIP>=9.0.3 | |
Si es menor actualizar PIP Manualmente con esto: | |
"curl https://bootstrap.pypa.io/get-pip.py | python" | |
Fuente Stackoverflow: https://stackoverflow.com/questions/49743961/cannot-upgrade-pip-9-0-1-to-9-0-3-requirement-already-satisfied/49758204#49758204 | |
8. "pip install ipython" | |
9. "pip install jupyter" | |
-ver guia: https://taufiqhabib.wordpress.com/2016/12/18/intalling-jupyter-in-a-virtualenv/ | |
-cada vez q se instala una dependencia, comprobar si se instaló dentro de la ruta de pyEnv con "which (nombre de la libreria)" ó "pip list": show packages installed within the virtual environment | |
10. "pip install flask" | |
-cuando se quiera hacer deploy de un modelo de kERAS por ej: https://www.youtube.com/watch?v=_yoxrAIf5u4&index=23&list=PLZbbT5o_s2xrwRnXk_yCPtnqqo4_u2YGL | |
-Run Flask inside pyEnv (y considerar en q carpeta estas y que ruta es la que se hace call): | |
export FLASK_APP=(python file) FLASK_ENV=development | |
flask run --host=0.0.0.0 | |
And then check in the browser: http://localhost:5000/sample for example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment