GNU/Linux >> Linux の 問題 >  >> Ubuntu

`pip`にデフォルトではないPython3.7を使用させますか?

これはすでに何度も尋ねられた質問と似ていますが、それでも信頼できる解決策を得ることができません。
Ubuntu16.04には2.7から最新の3.7.4までの多くのバージョンのPythonがインストールされています。

デフォルトは2.7です。デフォルトを変更するべきではないことはわかっています。他の人が変更し、システムの故障と同じくらい深刻な問題を引き起こしたからです。
ただし、pipを介してソフトウェアをインストールする必要があります:

pip install damn_software

Python> =3.6

が必要です
:~$ pip install damn_software
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Collecting damn_software
Using cached https://files.pythonhosted.org/packages/cc/19/632db1d5095a35b08ba000d63e1ceffaf56c730dbd259f021e1fb7a75f68/damn_software-0.1.8.tar.gz
ERROR: Command errored out with exit status 1:
 command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qDPgIM/damn_software/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qDPgIM/damn_software/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
     cwd: /tmp/pip-install-qDPgIM/damn_software/
Complete output (1 lines):
ERROR: Python (3, 5) or later is required by software-helpers for damn_software
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

これを回避する方法がわかりませんか?多分シンボリックリンク?

編集 :インストールを完了する前に、次の追加コマンドを実行する必要がありました:

python3.7 -m pip install --user --upgrade pip
python3.7 -m pip install your_packages
sudo apt install python3.7-dev 

承認された回答:

pipを使用して、必要なバージョンのPythonインタープリターを実行するだけです。 実行するモジュールとして:

python3.6 -m pip install some_package

そうすれば、スクリプトを起動するインタープリターが、pipパッケージを管理するインタープリターと同じであると100%確信できます。システムの変更は必要ありません。

pip 実行可能ファイルは、とにかく固定バージョンとして正確に定義されていません。次に更新が行われると、実行可能ファイルが再び上書きされる可能性があります。さらに、バージョンの非互換性などの他の理由で壊れることもあります。正確に定義されているvenv(Python仮想環境)にいる場合を除いて、通常は直接使用しません。

関連:NvidiaGPUとUbuntu16.04の問題?
Ubuntu
  1. SkypeにNotify-osdを使用させる方法は?

  2. コマンドの使用: `コマンド`?

  3. Linuxでpythonプログラムを実行可能にするために何を使用しますか

  1. Startxに代替Xinitrcを使用させる方法は?

  2. (ターミナルベースの)Vimでメニューを作成して使用することは可能ですか?

  3. pip と pip3 - どちらも python3.5 を指していますか?

  1. Unetbootinを使用して起動可能なWindowsUSBインストーラーを作成する方法は?

  2. Firefoxにパスワードの保存と取得にGnomeKeyringVaultを使用させる方法は?

  3. ソースコードからインストールされたPython3.5.0をアンインストールする方法は?