サーチ…


ウィンドウのvirtualenvwrapperによる仮想環境

3つのプロジェクトA、プロジェクトB、プロジェクトC、プロジェクトA、プロジェクトBにはPython 3と必要なライブラリが必要です。しかし、プロジェクトCでは、Python 2.7と依存ライブラリが必要です。

そのためには、これらのプロジェクト環境を分離することがベストプラクティスです。個別のpython仮想環境を作成するには、以下の手順に従う必要があります。

ステップ1:このコマンドでpython -m pip install -U pippython -m pip install -U pip

ステップ2:次に、コマンドを使用して "virtualenvwrapper-win"パッケージをインストールします(コマンドはWindows Power Shellを実行できます)。

pip install virtualenvwrapper-win

手順3:コマンドを使用して新しい仮想環境を作成する: mkvirtualenv python_3.5

ステップ4:コマンドを使用して環境をアクティブにする:

workon < environment name>

virtualenvwrapperの主なコマンド:

mkvirtualenv <name>
Create a new virtualenv environment named <name>. The environment will be created in WORKON_HOME.

lsvirtualenv
List all of the enviornments stored in WORKON_HOME.

rmvirtualenv <name>
Remove the environment <name>. Uses folder_delete.bat.

workon [<name>]
If <name> is specified, activate the environment named <name> (change the working virtualenv to <name>). If a project directory has been defined, we will change into it. If no argument is specified, list the available environments. One can pass additional option -c after virtualenv name to cd to virtualenv directory if no projectdir is set.

deactivate
Deactivate the working virtualenv and switch back to the default system Python.

add2virtualenv <full or relative path>
If a virtualenv environment is active, appends <path> to virtualenv_path_extensions.pth inside the environment’s site-packages, which effectively adds <path> to the environment’s PYTHONPATH. If a virtualenv environment is not active, appends <path> to virtualenv_path_extensions.pth inside the default Python’s site-packages. If <path> doesn’t exist, it will be created.


Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow