Tuesday, April 11, 2017
Friday, March 24, 2017
Edit $PATH After Anaconda Installed If 'conda' Command Can't Be Found
Anaconda is a Python package utility which contains many great packages for scientific and mathematical computation. Users just install it once and it’s all set.
Problem after installation:
The ‘conda’ command can’t be found after Anaconda installed.
Solution:
Edit the paths file in the user’s root directory according to the shell used( bash or zsh).
if using bash shell, edit .bashrc
file.
if using zsh shell, edit .zshrc
file.
Add the following line to the end of the file and save.
export PATH="$HOME/anaconda/bin:$PATH"
Reopen the terminal and it’s all done!
Thursday, March 23, 2017
Docker Command Note
Version
$docker --version
Docker version 1.12.0, build 8eab29e$
docker-compose --version
docker-compose version 1.8.0, build f3628c7$
docker-machine --version
docker-machine version 0.8.0, build b85aac1docker pull ubuntu:14.04
download latest ubuntu imagedocker images
list all imagesdocker run
deamon mode :
docker run -d -p 80:80 [ubuntu(image name)] --name webserver nginx
-d : Run container in background and print container ID
-p : Publish a container’s port(s) to the host
80: out/ 80: in
–name : Assign a name to the container
nginx : IMAGEinteractive mode :
docker run -it ubuntu:14.04 | bash
(啟動一台 ubuntu instance,並且切入bash模式)
-i: interactive mode, 讓操作者擁有互動模式
-t: terminal, 讓操作者可以使用終端機操作 instance
docker ps
show containers just running
docker ps -a
show all containers (default shows just running)docker start
start one or more stopped containersdocker stop
stop one or more running containersdocker kill
kill one or more running containersdocker rm
remove one or more containersdocker rmi
remove one or more imagesdocker port xxxx
list port mappings or a specific mapping for the running container
Ubuntu Commands
- sudo apt-get update
- sudo apt-get dist-upgrade
Saturday, March 4, 2017
Python And Jupyter Installation
Install Python in Mac OS X
1. Using brew
is the fastest way.
python2
> brew install python
python3
> brew install python3
2. Check The Version
> python --version
Python 2.7.10
> python3 --version
Python 3.5.1
3. Check The Location of Python and Setup The Path
Mac OS X has built-in Python 2.7. By using ‘which’ command to check the location where Python installed, you can find out whether is it the system built-in python.
> which python
usr/bin/python ⇒ system built-in
In order to access to the correct version of Python installed, we need to add /usr/local/bin
to $PATH.
You can use vim to edit the /etc/paths
> sudo vim /etc/paths
make sure that /usr/local/bin
is before /usr/bin
.
or just…
> export PATH=/usr/local/bin:$PATH
Close the terminal and reopen it again to make sure all the settings are effective.
Then check the location of Python again.
> which python
/usr/local/bin/python
> which python3
/usr/local/bin/python3
Done!
If you always using Python 3, you can edit the setting:
> vim ~/.bash_profile
and add:
alias python="python3"
Installing Jupyter
Python2
> pip install jupyter
Python3
> pip3 install jupyter
After installation, using following command to start jupyter.
> jupyter notebook