Python 在 Windows 7 上安装 TensorFlow - 'pip3' 不被识别为内部或外部命令,
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42559222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installation of TensorFlow on windows 7 - 'pip3' is not recognized as an internal or external command,
提问by Lech Migdal
When following the Installing TensorFlow for Windows guide https://www.tensorflow.org/install/install_windows, after executing
当遵循为 Windows 安装 TensorFlow 指南https://www.tensorflow.org/install/install_windows 时,执行后
C:\> pip3 install --upgrade tensorflow
I get the following error:
我收到以下错误:
'pip3' is not recognized as an internal or external command,
It looks like pip3 isn't recognized at all (although PATH to python is set)
看起来根本无法识别 pip3 (尽管设置了 python 的 PATH )
回答by Lech Migdal
Run the following
运行以下
python -m pip install --upgrade tensorflow
Assuming python is working, TensorFlow should get installed (at least the "Validate the installation" step is green).
假设 python 正在工作,TensorFlow 应该被安装(至少“验证安装”步骤是绿色的)。
回答by Rajesh Gupta
This will work, if you are facing pip3 or pip is not recognized as an internal or external command issue on windows:
如果您面对 pip3 或 pip 在 Windows 上未被识别为内部或外部命令问题,这将起作用:
- From the desktop, right click the Computer icon.
- Choose Properties from the context menu.
- Click the Advanced system settings link.
- Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit.
- A new pop up will open. Variable name will remain Path. We will change the Variable value to the location of the folder where your python scripts folder is located. Find it.
- 在桌面上,右键单击计算机图标。
- 从上下文菜单中选择属性。
- 单击高级系统设置链接。
- 单击环境变量。在 System Variables 部分,找到 PATH 环境变量并选择它。单击编辑。
- 将打开一个新的弹出窗口。变量名将保持为 Path。我们将变量值更改为您的 python 脚本文件夹所在文件夹的位置。找到它。
For e.g. I changed its value to
C:\Users\rgupta6\AppData\Local\Programs\Python\Python35\Scripts
例如,我将其值更改为
C:\Users\rgupta6\AppData\Local\Programs\Python\Python35\Scripts
- Close all remaining windows. Reopen Command prompt window, and run your
pip3 install --upgrade tensorflow
command orpip3 install tensorflow
command
- 关闭所有剩余的窗口。重新打开命令提示符窗口,然后运行您的
pip3 install --upgrade tensorflow
命令或pip3 install tensorflow
命令
回答by Divakar Rajesh
That is because you haven't setup the environment variable yet.
那是因为你还没有设置环境变量。
Follow the steps by @rajesh
按照@rajesh 的步骤操作
I had the same problem and i found his answer helpful
我遇到了同样的问题,我发现他的回答很有帮助
- Right click on This PC > Select Properties
- Select Advanced system settings on the left
- In the dialog box select Environment Variables
- In the system variables section select path and cllck on edit
- Select new and enter the path where the python scripts are..
- 右键单击此电脑 > 选择属性
- 选择左侧的高级系统设置
- 在对话框中选择环境变量
- 在系统变量部分选择路径并点击编辑
- 选择new并输入python脚本所在的路径..
it is mostly in C:\Users[your user name]\AppData\Local\Programs\Python\Python36\Scripts
它主要位于 C:\Users[您的用户名]\AppData\Local\Programs\Python\Python36\Scripts
- Then ok.. to all the boxes opened
- Close cmd if it is already open and now try installing tensorflow using pip again like this
- 然后好的..对所有打开的盒子
- 如果 cmd 已经打开,请关闭它,然后像这样再次尝试使用 pip 安装 tensorflow
pip3 install --upgrade tensorflow
回答by Lanka
Before running pip3 install --upgrade tensorflow
you need check if you are using the correct Python 3.5 installation:
在运行之前,pip3 install --upgrade tensorflow
您需要检查是否使用了正确的 Python 3.5 安装:
Python 3.5.2 [MSC v.1900 64 bit (AMD64)] on win32
Notice the 64 bit
part.
Otherwise, it gives the above error.
You are going to install tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
, therefore double check your correct version (mostly this is happening you have both Python 2.7 and 3.5).
注意64 bit
部分。
否则,它会给出上述错误。
您将要安装tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
,因此请仔细检查您的正确版本(大多数情况下,您同时拥有 Python 2.7 和 3.5)。
回答by Joseph Sun
when installing python, on the install window, check the box "Active path"(something like that), which builds up a path link. So you can run "pip3 install" at anywhere.
安装python时,在安装窗口中,选中“活动路径”框(类似的东西),它会建立一个路径链接。所以你可以在任何地方运行“pip3 install”。
回答by Sid Ray
The issue is your path in the cmd is not that of where your python scripts are placed. In this case you can either navigate to "AppData\Local\Programs\Python\Python36\Scripts" in your terminal and then run the command or you can simply put C:\Users\Your User Name\AppData\Local\Programs\Python\Python36\Scripts to Path variable.
问题是您在 cmd 中的路径与放置 python 脚本的位置不同。在这种情况下,您可以导航到终端中的“AppData\Local\Programs\Python\Python36\Scripts”,然后运行该命令,或者您可以简单地输入 C:\Users\Your User Name\AppData\Local\Programs\Python \Python36\Scripts 到 Path 变量。
Then re-launch your cmd and type "pip3 install tensorflow" and see the feel the happiness :)
然后重新启动你的 cmd 并输入“pip3 install tensorflow”,看看感觉很幸福:)
回答by nikodean2
Typing the python command before that should do the trick. In my case (on Windows 8.1 with Python 3.6), I had to type 'py' instead of 'python' as follows:
在此之前输入 python 命令应该可以解决问题。在我的情况下(在带有 Python 3.6 的 Windows 8.1 上),我必须输入“py”而不是“python”,如下所示:
py -m pip install --upgrade tensorflow
py -m pip install --upgrade tensorflow
The answer depends on the system you're using.
答案取决于您使用的系统。
回答by JunMing
I just experienced the same issue, most likely you downloaded a zipped version of python, then unzipped it, and added it to $PATH just like me, python can work but pip3 cannot, and python -m pip cannot either. fix solution is to download a executable version of python, then follow common installation steps, pip3 is selected by default, then everything is OK now.
我刚刚遇到了同样的问题,很可能你下载了一个压缩版本的 python,然后解压缩它,然后像我一样将它添加到 $PATH 中,python 可以工作,但 pip3 不能,python -m pip 也不能。fix 解决办法是下载一个可执行版本的python,然后按照一般的安装步骤进行,默认选择pip3,那么现在就一切OK了。