@CrazyHenry
2018-01-19T18:07:48.000000Z
字数 901
阅读 1293
ppppPython入门
sudo apt-get install python-dev python3-dev//python-dev为python2
sudo apt-get upgrade python-dev python3-dev
sudo apt-get install python-pip
sudo pip2 install --upgrade pip //升级pip2
sudo apt-get install python3-pip
sudo pip3 install --upgrade pip
sudo pip2 install xxx == 0.9.0
sudo pip3 install 'xxx >= 0.9.0'
sudo pip3/pip2 install -r requirements.txt
//requirements.txt 里:
//flask == 0.9.0
//xxx
//xxx
有时python模块需要源码安装:
sudo python install setup.py //就用python,不管2/3
sudo pip2 install --upgrade 包名
sudo pip3 install --upgrade 包名
sudo pip2/pip3 uninstall xxx
#!/usr/bin/env python2.7
./
执行,也可以使用python执行(2/3都一样)python2.7/python
或者python3.5
命令执行virtualenv
管理python项目
sudo apt-get install virtualenv
sudo apt-get --upgrade virtualenv
virtualenv -p python3.5 xxx
. xxx/bin/activate
sudo pip3 install xxx //在该环境下安装所需模块
在该环境进行项目开发
deactivate
rmvirtualenv xxx //删除python项目