python venv

https://packaging.python.org/guides/installing-using-pip-and-virtualenv/

Activating a virtualenv

Before you can start installing or using packages in your virtualenv you’ll need to activate it. Activating a virtualenv will put the virtualenv-specific python and pip executables into your shell’s PATH.

On macOS and Linux:

source env/bin/activate

On Windows:

.\env\Scripts\activate

You can confirm you’re in the virtualenv by checking the location of your Python interpreter, it should point to the env directory.

On macOS and Linux:

which python .../env/bin/python

On Windows:

where python .../env/bin/python.exe

As long as your virtualenv is activated pip will install packages into that specific environment and you’ll be able to import and use packages in your Python application.

https://stackoverflow.com/questions/12079607/make-virtualenv-inherit-specific-packages-from-your-global-site-packages?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Create the environment with virtualenv --system-site-packages . Then, activate the virtualenv and when you install things use pip install --ignore-installed or pip install -I . That way pip will install what you've requested locally even though a system-wide version exists. Your python interpreter will look first in the virtualenv's package directory, so those packages should shadow the global ones.

python -m pip install --upgrade pip easy_install pip

转载于:https://my.oschina.net/u/1177171/blog/1648826

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值