0
0

【Python】依存関係でコンフリクトするなら仮想環境を使う

Last updated at Posted at 2024-09-06

モジュールインストールの際にコンフリクト

形態素解析を行う為

pip install spacy

を行った際、下記エラー

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
awsebcli 3.20.10 requires colorama<0.4.4,>=0.2.5, but you have colorama 0.4.6 which is incompatible.

cloloramaというモジュールが他のパッケージで使われているバージョンと合わない為依存関係のコンフリクトになっているという警告です。

coloramaのモジュールをダウングレードして対応するも下記エラー

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
wasabi 1.1.3 requires colorama>=0.4.6; sys_platform == "win32" and python_version >= "3.7", but you have colorama 0.4.3 which is incompatible.

やはりバージョンが合わないみたいなので仮想環境を作って依存関係を分離する方法で解決します。

仮想環境作成

Terminalで下記を実行。
開発環境を作ります。

python -m venv myenv

下記コマンドで仮想環境をアクティブにします。
VScodeのTerminalでうまくいかなかった場合、管理者権限でPowerShellを使って行う必要があるかもしれません。

myenv\Scripts\activate

このあと好きなモジュールをインストールしてください

pip install colorama

など

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0