일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- HFS+
- virtual
- Matplotlib
- openmp
- h5py
- Windows
- HDF5
- hyperref
- mpi4py
- cython
- cygwin
- GSL
- python
- Anaconda
- c++
- conda
- datascience
- polyglot
- arXiver
- MAC
- intel compiler
- tab space
- SSH
- vim
- gfortran
- Visual Studio
- vi
- portforwarding
- jupyter
- LaTeX
- Today
- Total
Astro Coke
[Python] Switching between python 2.x and 3.x 본문
source: https://towardsdatascience.com/environment-management-with-conda-python-2-3-b9961a8a5097
List your Environments
This command shows you all the This is a really helpful command to see what environments you have, but also to see what conda environment you are in.
> conda env list
Remove an Environment
If the name of your environment you want to remove is not subscribe, you will need to substitute "py36" for the name of your environment you want to remove.
> conda env remove --name py36
Switch the environment
> source activate py36
if you want to deactivate,
> conda deactivate
set the default environment
in .bashrc (linux) or .bash_profile (mac)
add the path of the environment to be defult:
e.g.) py36 environment
export PATH="/Users/astrodoo/anaconda2/envs/py36/bin:$PATH"
source activate py36
Disable prompt change
> conda config --set changeps1 False
or add
changeps1: False
in .condarc
Using Both Python 2.x and Python 3.x Environments in IPython Notebook
While this section of the post was largely taken and improved from stackoverflow, I feel like it is important to go over how and go over some technical issues people run into. The main idea is to have multiple ipython kernels. The package nb_conda_kernels will automatically detect different conda environments with notebook kernels and automatically register them.
- Make sure you have anaconda 4.1.0 or higher. Open a new terminal and check your conda version by typing
checking conda version
if you are below anaconda 4.1.0, type conda update conda
2. Next we check to see if we have the library nb_conda_kernels by typing
Checking if we have nb_conda_kernels
3. If you don’t see nb_conda_kernels type
Installing nb_conda_kernels
4. If you are using Python 2 and want a separate Python 3 environment please type the following
py36 is the name of the environment. You could literally name it anything you want.
If you are using Python 3 and want a separate Python 2 environment, you could type the following.
py27 is the name of the environment. It uses python 2.7.
5. Close your terminal and open up a new terminal. type jupyter notebook
6. Click new and you will see your virtual environment listed.
'Computer Setup' 카테고리의 다른 글
[Cygwin] Import User Path Variable in Windows when access with SSH (0) | 2019.04.04 |
---|---|
[Cygwin] Using Tex Live in Cygwin (0) | 2019.04.04 |
[Python] inline backend 와 matplotlibrc 의 충돌 (0) | 2019.04.03 |
[Cython&openmp] omp.h file not found (0) | 2019.03.28 |
[Python] Vim: Fix python indentation Error (0) | 2019.03.28 |