Create the following file in yml format.
name: virtual environment name (here py2) dependencies: Required package list
name: py2
channels:
- conda-forge
dependencies:
- python=2.7
- xarray
- netCDF4
- seaborn
- numpy
- matplotlib
- scipy
- pip:
- cyordereddict
- sqlalchemy
- model-organization
After that, create a new virtual environment and activate it with the following command.
$ conda env create -f environment.yml
$ source /home/user-name/.pyenv/versions/anaconda3-4.1.0/envs/py2/bin/activate py2
(If you do not specify activate with the full path, it may fail.)
$ source activate <anaconda environment name>
$ pip install <Module name>
Checking the existing environment name The default is root
$ conda info --envs
jupyter notebook
$ jupyter notebook --port xxxx
Alternatively, edit the jupyter notebook settings. c. Comment out NotebookApp.port and set the port number.
$ .jupyter/jupyter_notebook_config.py
c.NotebookApp.port = xxxx
If you have not created a profile, create it with the following command
$ ipython profile create
This will ~/.ipython/profile_default/ipython_config.py Is created.
If you edit as follows,% matplotlib inline will be loaded at startup, and the matplotlib graph will be displayed inline.
# lines of code to run at IPython startup.
# c.InteractiveShellApp.exec_lines = traitlets.Undefined
c.InteractiveShellApp.exec_lines = ['%matplotlib inline']
Recommended Posts