移植第一个django项目

该教程详细介绍了如何在Ubuntu系统中搭建Python3.5环境,包括使用pvenv创建虚拟环境,安装miniconda,选择安装Python3.5的两种方法,安装pip和相关依赖包,以及配置MySQL和远程访问。此外,还涵盖了通过pip安装需求文件和启动Python应用的步骤。
摘要由CSDN通过智能技术生成

搭建pvenv

git clone https://gitee.com/feiyujun/pyenv.git ~/.pyenv
sudo vim /etc/profile
export PYENV_ROOT="/root/.pyenv"  #这里需要改成用户电脑的具体地址
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev
apt-get install -y openssl
apt-get install -y libssl-dev

安装miniconda

wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 777 Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
  1. Do you accept the license terms? [yes|no]---------->yes
  2. Miniconda3 will now be installed into this location:xxxx 这个地址需要记忆,一般情况下是~/miniconda3
  3. Do you wish the installer to initialize Miniconda3 by running conda init? [yes|no]----->no
echo "export  PATH="/home/gaoxiang/miniconda3/bin:"$PATH" >>  ~/.bashrc
source ~/.bashrc

安装python3.5

方案一

apt-get install software-properties-common

方案二

  1. 安装python
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar -xvzf Python-3.5.2.tgz
cd Python-3.5.2
./configure --prefix=/usr/local/python35
make -j4
make install
cp /usr/local/python35/bin/python3.5 /usr/bin
  1. 安装pip
curl https://bootstrap.pypa.io/pip/3.5/get-pip.py -o get-pip.py
python3.5 get-pip.py
cp /usr/local/python35/bin/pip3.5 /usr/bin

note: 安装pip时候可能会出错,可以前往系统已安装的python lib目录下拷贝一个文件过来,下例是我这边的文件路径

cp /usr/lib/python3/dist-packages/lsb_release.py /usr/local/python35/lib/python3.5/

安装依赖包

pip install -r requirements.txt
pip install -r requests.txt

安装mysql

apt-install install -y mysql-server

设置宿主机Navicat允许访问

在mysqld.cof中设置 bind-address = 0.0.0.0

vim /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart

运行

python3.5 mamger.py runserver
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值