2019-10-31 sublime sublimeREPLプラグインをインストールした後tensorflowエラーを解決
2563 ワード
問題の原因:cmdでimport tensorflow sublimeにコンパイルシステムを新規作成してpythonを設定したりimportを実行したりすることができます.sublimeREPLをインストールした後にエラーが発生します.
私の解決策のデフォルトのパスは、あなたの環境変数のpythonパス、すなわちcmdでpythonを入力するパスを指しています.これからは・・・anacondaenvstensorflowのpythonパス1、sublimeでプリファレンスをクリックし、プラグインディレクトリを参照し、sublimeREPL->config->python->Mainを開きます.sublime-menu(sublimeが開くまでドラッグ)2、次の部分のコードを見つけます
注意修正部分は、自分の仮想環境でのパスに基づいて3、ctrl+sを記入してsublimeを再起動し、次のコードブロックを実行します.
あなたが望む結果を出力したのではないでしょうか.
他に何か間違いがあったらメッセージを残して議論してもいいですよ.
私の解決策のデフォルトのパスは、あなたの環境変数のpythonパス、すなわちcmdでpythonを入力するパスを指しています.これからは・・・anacondaenvstensorflowのpythonパス1、sublimeでプリファレンスをクリックし、プラグインディレクトリを参照し、sublimeREPL->config->python->Mainを開きます.sublime-menu(sublimeが開くまでドラッグ)2、次の部分のコードを見つけます
{
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["E:\\anaconda\\envs\\tensorflow\\python", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
注意修正部分は、自分の仮想環境でのパスに基づいて3、ctrl+sを記入してsublimeを再起動し、次のコードブロックを実行します.
import tensorflow as tf
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
message = tf.constant("welcome")
with tf.Session() as sess:
print(sess.run(message).decode())
あなたが望む結果を出力したのではないでしょうか.
他に何か間違いがあったらメッセージを残して議論してもいいですよ.