CISCN 应用环境相关指令备忘录

1 - 关于Python环境的

使用Anaconda2管理Python环境

1.1 - 安装

官网下载安装包下载。

1.2 - 创建Python环境

localhost:template mac$ conda create --name python36 python=3.6
Solving environment: done

## Package Plan ##

  environment location: /anaconda2/envs/python36

  added / updated specs: 
    - python=3.6

.........

装Python2或者3都行,随意。

1.3 - 查看Python环境 conda info -e

localhost:template mac$ conda info -e
# conda environments:
#
face_recognition         /Users/mac/.conda/envs/face_recognition
test2                    /Users/mac/.conda/envs/test2
base                  *  /anaconda2
python27                 /anaconda2/envs/python27
python36                 /anaconda2/envs/python36

带 * 号的是当前的环境。

1.4 - 激活Python环境

activate python34 # for Windows
source activate python34 # for Linux & Mac

效果如下:

localhost:template mac$ source activate python36
(python36) localhost:template mac$

1.5 - 查看当前环境安装的库 conda list

1.6 - 在当前环境安装库 conda install lib_name

(python36) localhost:template mac$ conda install requests
Solving environment: done

## Package Plan ##

  environment location: /anaconda2/envs/python36

  added / updated specs: 
    - requests


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    requests-2.14.2            |           py36_0         720 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

The following NEW packages will be INSTALLED:

    requests: 2.14.2-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? y


Downloading and Extracting Packages
requests-2.14.2      |  720 KB | ############################################################################# | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

1.7 -退出当前环境

deactivate python34 # for Windows
source deactivate python34 # for Linux & Mac

2 - 关于docker

安装不提了,直接写怎么使用官方complete

2.1 - 下载环境 git clone

2.2 - 部署环境

举例,终端进入deploy文件夹,输入docker-compose up -d

localhost:ciscn2018-template mac$ cd CISCN-2018-web-for-players/
localhost:CISCN-2018-web-for-players mac$ ls
README.md	checker		template
localhost:CISCN-2018-web-for-players mac$ cd template/
localhost:template mac$ ls
README.md	deploy		writeup.md
localhost:template mac$ cd deploy/
localhost:deploy mac$ ls
Dockerfile		requirement.pip		www
docker-compose.yml	start_sshop.sh
localhost:deploy mac$ docker-compose up -d
Starting deploy_sshop_1 ... done

2.3 - 查看容器状态 docker ps

localhost:deploy mac$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                      NAMES
036006fd2513        deploy_sshop        "/sbin/my_init"     7 hours ago         Up 9 minutes        0.0.0.0:22->22/tcp, 0.0.0.0:80->8233/tcp   deploy_sshop_1

2.4 - 打开容器bash

docker run -t -i deploy_sshop /bin/bash
//docker run 运行
// -t -i 后台,打开读写
//deploy_sshop 容器名称或者ID
///bin/bash 应用bash

2.5 - 文件传输

docker cp <containerId>:/file/path/within/container /host/path/target  

2.6 - 退出容器 exit

直接输入 exit 就好。

2.7 - 查看容器操作系统

�� ��������������cat /etc/os-release //linux

2.8 - 列出镜像

docker image ls

2.9 - 查看镜像、容器、数据卷所占空间

docker system df

3 - checker.py 使用

3.1 - 运行环境Python2*

输入参数四个:

python ./checker.py 0.0.0.0 80 _xrsf

3.2 - 需要下载两个依赖包:

conda install requests
conda install pyquery
posted @ 2018-05-23 17:34  blackay03  阅读(339)  评论(0编辑  收藏  举报
Live2D
*/