美文网首页
Go_Python 项目环境搭建流程

Go_Python 项目环境搭建流程

作者: HueyYao | 来源:发表于2021-09-25 01:16 被阅读0次

    mysql,navicat安装

    docker pull mysql:5.7
    
    docker run -p 3306:3306 --name mysql_0912 -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
    
    简述:
        -p 3306:3306 将容器的3306端口映射到主机的3306端口上
        -v $PWD/conf:/etc/mysql/conf.d 讲主机当前的目录下的conf/my.cnf挂载到容器
        的/etc/mysql/conf.d
        -v $PWD/data:/var/lib/mysql 讲主机的当前目录下的data目录挂载到容器的/var/lib/mysql
        -e MYSQL_ROOT_PASSWORD=123456 初始化root账号的密码
    
    docker ps -a 获取mysql的容器信息
    执行
    docker exec -it 容器id /bin/bash
    进入myql后 执行
    mysql -uroot -p123456 
    进入交互界面
    
    进行授权
        GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
        GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;
        GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;
        FLUSH PRIVILEGES;
    

    python环境安装

    windows:https://www.python.org/downloads/release/python-386/

    centos安装

    先安装依赖包
        yum -y install mariadb-devel libffi-devel python-devel gcc gcc-c++ expat-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel
    下载
        wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
        tar -xzvf Python-3.8.6.tgz -C /tmp
        cd /tmp/Python-3.8.6/
    把pyton3.8安装到 /usr/local目录
        ./configure --prefix=/usr/local
        make
        make altinstall
    更改/user/bin/python连接
        ln -s /usr/local/bin/python3.8 /usr/bin/python3
        ln -s /usr/local/bin/pip3.8 /usr/bin/pip3
    

    安装python的虚拟环境

    yum install python-setuptools python-devel
    pip3 install virtualenvwrapper
    
    配置python
    vim ~/.bashrc
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh 
    注释:virtualenvwrapper.sh 的路径配置前可以find一下
    source ~/.bashrc
    
    mkvirtualenv python_start
    
    ls ~/.virtualenvs/
    

    linux安装go

    wget https://dl.google.com/go/go1.16.8.linux-amd64.tar.gz
    
    tar -xvf go1.16.8.linux-arm64.tar.gz
    
    配置go
    vim ~/.bashrc
    
     export GOROOT=/root/go
     export GOPATH=/root/go/src
     export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
    
    source ~/.bashrc
    
    配置代理
    go env -w GOPROXY="https://goproxy.cn,direct"
    go env -w GO111MODULE=on
    

    linux安装nodejs

    wget https://cdn.npm.taobao.org/dist/node/v16.9.1/node-v16.9.1-linux-x64.tar.xz
    
    tar -xvf  node-v16.9.1-linux-x64.tar.xz
    
    简历软链接
    
    ln -s /root/node-v16.9.1-linux-x64/bin/node /usr/bin/node
    ln -s /root/node-v16.9.1-linux-x64/bin/npm /usr/bin/npm
    

    相关文章

      网友评论

          本文标题:Go_Python 项目环境搭建流程

          本文链接:https://www.haomeiwen.com/subject/atitnltx.html