requirements.txt的创建及使用

requirements.txt的创建及使用

 

python项目中必须包含一个 requirements.txt 文件,用于记录所有依赖包及其精确的版本号。以便新环境部署。

在虚拟环境中使用pip生成:

(venv) $ pip freeze >requirements.txt

  

安装或升级包后,最好更新这个文件。

需求文件的内容示例如下:

cached-property==1.3.0
certifi==2017.4.17
chardet==3.0.4
defusedxml==0.5.0
Django==1.11.3
django-braces==1.11.0
django-filter==1.0.4
django-oauth-toolkit==1.0.0
django-redis==4.8.0
django-rest-framework-social-oauth2==1.0.8
django-url-filter==0.3.3
djangorestframework==3.6.3
django-cors-headers==2.1.0
enum34==1.1.6
idna==2.5
Markdown==2.6.8
oauthlib==2.0.2
PyJWT==1.5.2
PyMySQL==0.7.11
python3-openid==3.1.0
pytz==2017.2
redis==2.10.5
requests==2.18.1
requests-oauthlib==0.8.0
six==1.10.0
social-auth-app-django==1.2.0
social-auth-core==1.4.0
urllib3==1.21.1
pycryptodome==3.4.7
Image==1.5.16
bs4==0.0.1
pyopenssl==17.3.0

  

当需要创建这个虚拟环境的完全副本,可以创建一个新的虚拟环境,并在其上运行以下命令:

(venv) $ pip install -r requirements.txt

  

 

posted on 2017-11-24 00:00  何必从头  阅读(111)  评论(0)    收藏  举报

导航