官术网_书友最值得收藏!

pip and virtualenv

The recommended practice for installing dependencies is to create a virtualenv. A virtualenv (https://packaging.python.org/guides/installing-using-pip-and-virtualenv/) acts like a complete separate Python installation from the one that comes with your operating system, making it safe to install the packages required by your application without risk of breaking your system Python or tools.

Now we will learn how to create a virtual environment and install pytest using pip. If you are already familiar with virtualenv and pip, you can skip this section:

  1. Type this in your Command Prompt to create a virtualenv:
λ python -m venv .env
  1. This command will create a .env folder in the current directory, containing a full-blown Python installation. Before proceeding, you should activate the virtualenv:
λ source .env/bin/activate

Or on Windows:

λ .env\Scripts\activate

This will put the virtualenv Python in front of the $PATH environment variable, so Python, pip, and other tools will be executed from the virtualenv, not from your system.

  1. Finally, to install pytest, type:
λ pip install pytest

You can verify that everything went well by typing:

λ pytest --version
This is pytest version 3.5.1, imported from x:\fibo\.env36\lib\site-packages\pytest.py

Now, we are all set up and can begin!

主站蜘蛛池模板: 高平市| 宁夏| 拜城县| 沅陵县| 新化县| 桦甸市| 十堰市| 五大连池市| 楚雄市| 平乐县| 南平市| 右玉县| 定边县| 滨州市| 怀来县| 宁远县| 丰台区| 巴南区| 静安区| 蓬安县| 年辖:市辖区| 延边| 敦化市| 萨嘎县| 汝阳县| 安阳县| 连江县| 祁门县| 荔浦县| 神农架林区| 北京市| 云林县| 保定市| 准格尔旗| 阜阳市| 陇南市| 体育| 五寨县| 凉城县| 察哈| 深水埗区|