entornos python
De Wikicima
(Diferencias entre revisiones)
(Añadiendo página de entornos de python) |
|||
Línea 2: | Línea 2: | ||
Following instructions from [http://docs.python-guide.org/en/latest/dev/virtualenvs/ python environments] |
Following instructions from [http://docs.python-guide.org/en/latest/dev/virtualenvs/ python environments] |
||
+ | |||
+ | # Creation of the place where the environment will reside |
||
+ | <pre> |
||
+ | mkdir -p {HOME}/bin/py27env |
||
+ | cd {HOME}/bin/py27env |
||
+ | </pre> |
||
+ | |||
+ | # Install <code>virtualenv</code> |
||
+ | <pre> |
||
+ | $ pip install virtualenv |
||
+ | </pre> |
||
+ | |||
+ | # Test installation |
||
+ | <pre> |
||
+ | $ virtualenv --version |
||
+ | </pre> |
||
+ | |||
+ | # Create a virtual environment (e.g `py27env' to be used with python 2.7): |
||
+ | <pre> |
||
+ | $ virtualenv p /usr/bin/python2.7 ./ |
||
+ | </pre> |
||
+ | |||
+ | # Activate the environment |
||
+ | <pre> |
||
+ | $ source bin/activate |
||
+ | (py27env) $ |
||
+ | </pre> |
||
+ | |||
+ | # Installing packages |
||
+ | <pre> |
||
+ | (py27env) $ pip install numpy |
||
+ | Collecting numpy |
||
+ | Using cached numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl |
||
+ | Installing collected packages: numpy |
||
+ | Successfully installed numpy-1.13.3 |
||
+ | |||
+ | # Deactivating environment |
||
+ | <pre> |
||
+ | (py27env) $ deactivate |
||
+ | $ |
||
+ | </pre> |
||
+ | |||
+ | </pre> |
Revisión de 17:38 2 nov 2017
The generation of environments facilitate the specific requiremnts of each user for each purpose.
Following instructions from python environments
- Creation of the place where the environment will reside
mkdir -p {HOME}/bin/py27env cd {HOME}/bin/py27env
- Install
virtualenv
$ pip install virtualenv
- Test installation
$ virtualenv --version
- Create a virtual environment (e.g `py27env' to be used with python 2.7):
$ virtualenv p /usr/bin/python2.7 ./
- Activate the environment
$ source bin/activate (py27env) $
- Installing packages
(py27env) $ pip install numpy Collecting numpy Using cached numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl Installing collected packages: numpy Successfully installed numpy-1.13.3 # Deactivating environment <pre> (py27env) $ deactivate $
</pre>