entornos python
De Wikicima
Revisión a fecha de 17:38 8 nov 2017; Lluis.fita (Discusión | contribuciones)
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
- To know which packages are installed
(py27env) $ pip freeze numpy==1.13.3
- Deactivating environment
(py27env) $ deactivate $
Matplotlib
There are certain installation problems referred to the `mpl_toolkit'
- On a given instaltion:
(py27env) $ pip freeze backports.functools-lru-cache==1.4 cycler==0.10.0 ecmwf-api-client==1.5.0 matplotlib==2.1.0 netCDF4==1.3.1 numpy==1.13.3 pyparsing==2.2.0 python-dateutil==2.6.1 pytz==2017.3 scipy==1.0.0 six==1.11.0 subprocess32==3.2.7
- There is not `basemap'
from mpl_toolkits.basemap import Basemap ImportError: No module named basemap
- but it is not found in the
pip
(py27env) $ pip install basemap Collecting basemap Could not find a version that satisfies the requirement basemap (from versions: ) No matching distribution found for basemap
- Thus, we will need to manually install `matplotlib' and `basemap' (following Matplolib installation. Unpacking the different packages...
(py27env) $ mkdir $HOME/Downloads (py27env) $ cd Downloads/