CISCN 半决赛环境使用备忘录

关于Python环境的

使用Anaconda2管理Python环境

创建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

.........

查看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

激活Python环境

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

效果如下:

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

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

在当前环境安装库 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

退出当前环境

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

关于docker

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

下载环境 git clone

部署环境

举例,终端进入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

查看容器状态 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

打开容器bash

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

文件传输

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

退出容器 exit

直接用。

checker.py 使用

运行环境Python2*,输入参数四个

python ./checker.py 0.0.0.0 80 _xrsf

猜你喜欢

转载自www.cnblogs.com/blackay03/p/9078044.html