pip國內源:python
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
shell
https://packaging.python.org/guides/installing-using-pip-and-virtualenv/centos
Activating a virtualenvapp
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.ide
On macOS and Linux:ui
source env/bin/activategoogle
On Windows:url
.\env\Scripts\activatecentos7
You can confirm you’re in the virtualenv by checking the location of your Python interpreter, it should point to the env directory.code
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.
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
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -vxf Python-3.7.3.tgz cd Python-3.7.3
make