[英]Creating a virtualenv with preinstalled packages as in requirements.txt
Creating a virtualenv will create a virtual python environment with preinstalled pip, setuptools and wheels.创建 virtualenv 将创建一个虚拟 python 环境,其中预装了 pip、setuptools 和 wheels。
Is there a way to specify what packages to pre-install in that virtualenv apart from those 3 default ones?除了这 3 个默认包之外,有没有办法指定要在该 virtualenv 中预安装哪些包? Either with CLI arguments, a file, or environment variables of some sort.
使用 CLI arguments、文件或某种环境变量。
Ie is there something along the lines of virtualenv venv && venv/bin/pip install -r requirements.txt
which can be run in one command?即是否有类似
virtualenv venv && venv/bin/pip install -r requirements.txt
的东西可以在一个命令中运行?
Typically the steps you always takes are:通常,您始终采取的步骤是:
git clone <repo>
cd <repo>
pip install virtualenv
(if you don't already have virtualenv installed) pip install virtualenv
(如果你还没有安装 virtualenv)virtualenv venv
to create your new environment (called 'venv' here) virtualenv venv
来创建您的新环境(此处称为“venv”)source venv/bin/activate
to enter the virtual environment source venv/bin/activate
进入虚拟环境pip install -r requirements.txt
to install the requirements in the current environment pip install -r requirements.txt
安装当前环境下的需求You can do it with a tool called pipenv now!您现在可以使用名为 pipenv 的工具来完成!
https://www.kennethreitz.org/essays/announcing-pipenv https://www.kennethreitz.org/essays/annoucing-pipenv
Just run赶紧跑
pipenv install requests
And it will create a virtualenv and install requests in it它将创建一个 virtualenv 并在其中安装请求
Try this: virtualenv --system-site-packages venv试试这个:virtualenv --system-site-packages venv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.