Ubuntuのソース、Pythonの仮想環境とPIPソースの設定

ソースを変更するにはUbuntuのコマンドライン

source.listを変更する前に、良いアイデアのコピーを維持する
ソフトウェアのソースアドレス設定ファイルの/etc/apt/sources.listを

バックアップコマンドを実行します

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old

ファイルを開くには、コマンドを実行しSource.list:
VIM、geditの、原子や他のツールで開くことができます

sudo vim /etc/apt/sources.list

次の

# deb cdrom:[Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

設定PIPソース

ウィン下、%HOMEPATH%、PIP / pip.ini

国際下、〜/ .pip / pip.conf

次の

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

仮想環境の構成

環境:

  • Ubuntuの18.04
  • python3
如果系统同时安装了python2和3版本,请执行下面的命令

pip2 install virtualenv

pip2 install virtualenvwrapper

pip3 install virtualenv

pip3 install virtualenvwrapper

# Win 
pip install virtualenvwrapper-win

使用PIP3のインストールvirtualenvvirtualenvwrapper二つのパッケージ、ubuntu18.04、ユーザーの用途には、パッケージをインストールするPIP ~/.local/の下に.bashrc追加の構成は次のとおりです。

# Python Virtualenv Settings

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh

使用しmkvirtualenv、次のように与えられた、仮想環境を作成する場合:

roc@roc-ThinkPad-E455:~$ mkvirtualenv remote
ERROR: virtualenvwrapper could not find virtualenv in your path

ヒントはないvirtualenvの環境、パスvirtualenvの具体的な構成に設定ファイルを追加する必要がある次のとおりです。

# Python Virtualenv Settings

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
# 指定virtualenv的路径
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh

その後、リロード.bashrcにファイルを

おすすめ

転載: www.cnblogs.com/geoffreygao/p/12106915.html