简体   繁体   English

安装 tensorflow 但用 pip 替换 pip3 因为找不到 pip3。 错误?

[英]Installing tensorflow but replacing pip3 with pip because pip3 not found. Mistake?

Installed tensorflow but replacing every mention of "pip3" with "pip" because "pip3" was not found.已安装 tensorflow,但由于未找到“pip3”,因此将所有提及的“pip3”替换为“pip”。

It seems to have worked because I can run tensorflow scripts in qtConsole now.它似乎有效,因为我现在可以在 qtConsole 中运行 tensorflow 脚本。

Have I screwed myself in the long run somehow by not following the instructions on the website ( https://www.tensorflow.org/install/pip ), or am I good to go?从长远来看,我是否因为不遵循网站 ( https://www.tensorflow.org/install/pip ) 上的说明而自欺欺人,或者我可以去吗? If good to go, am I ok to install other things the same way?如果一切顺利,我可以用同样的方式安装其他东西吗?

Script I run:我运行的脚本:

mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation=tf.nn.softmax)
...

Out[1]: [0.08017649850141025, 0.9772]

Additional info附加信息

When I say pip3 not found, I mean to say当我说找不到 pip3 时,我的意思是说

pip3 install -U pip virtualenv

is met with遇到

ERROR: 'pip3' is not recognized as an internal or external command,
operable program or batch file.

Exact same code ran with "pip" rather than "pip3" works just fine.使用“pip”而不是“pip3”运行的完全相同的代码工作得很好。

pip3 installs packages to python v3.x while pip2 installs packages for python v2.x Which pip installs packages for the default python version you have installed. pip3将软件包安装到 python v3.x,而pip2为 python v2.x 安装软件包,其中pip为您安装的默认 python 版本安装软件包。 that can be python v2.x or python v3.x Tensorflow's old versions are python v2.x supported so it worked.可以是 python v2.x 或 python v3.x Tensorflow 的旧版本支持 python v2.x,所以它可以工作。 There is nothing to worry about.没有什么可担心的。 If you are using python2 you should definitely upgrade it to python3如果您使用的是 python2,则绝对应该将其升级到python3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM