### **查看Virtualenv版本及是否安装**
```
pip list
```
### **安装Virtualenv**
```
pip install virtualenv
//或者由于权限问题使用sudo临时提升权限
sudo pip install virtualenv
```
### **添加文件夹**
```
mkdir yourname
```
### * 切换文件夹**
```
cd yourname
```
### **切换文件夹并添加APP**
```
cd yourname
virtualenv app-name
```
### **激活虚拟环境**
```
source app-name/bin/activate
```
### **退出环境**
```
deactivate
```
### **导出列表**
```
pip freeze > requirements.txt
另存为utf-8格式就不会报错了
上传到根目录
pip install -r ~/requirements.txt
```
### **错误**
```
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JlkM6j/MySQL-python/
```
```
# 缺少包 libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
```
### 错误
```
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JlkM6j/MySQL-python/
```
```
# 缺少包 libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
txt里删除MySQL-python后,单独安装
```
### 错误
```
Could not find a version that satisfies the requirement urllib==1.21.1 (from -r /root/requirements.txt (line 56)) (from versions: )
No matching distribution found for urllib==1.21.1 (from -r /root/requirements.txt (line 56))
```