简体   繁体   English

在Windows 7上安装TensorFlow - 'pip3'不被识别为内部或外部命令,

[英]Installation of TensorFlow on windows 7 - 'pip3' is not recognized as an internal or external command,

When following the Installing TensorFlow for Windows guide https://www.tensorflow.org/install/install_windows , after executing 按照安装TensorFlow for Windows指南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根本不被识别(虽然设置了PATH到PATH)

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(至少“验证安装”步骤为绿色)。

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上的内部或外部命令问题,这将有效:

  1. From the desktop, right click the Computer icon. 在桌面上,右键单击“计算机”图标。
  2. Choose Properties from the context menu. 从上下文菜单中选择“属性”。
  3. Click the Advanced system settings link. 单击“高级系统设置”链接。
  4. Click Environment Variables. 单击“环境变量”。 In the section System Variables, find the PATH environment variable and select it. 在System Variables部分中,找到PATH环境变量并选择它。 Click Edit. 单击编辑。
  5. A new pop up will open. 一个新的弹出窗口将打开。 Variable name will remain Path. 变量名称将保留为Path。 We will change the Variable value to the location of the folder where your python scripts folder is located. 我们将Variable值更改为python脚本文件夹所在文件夹的位置。 Find it. 找到它。

For eg I changed its value to C:\\Users\\rgupta6\\AppData\\Local\\Programs\\Python\\Python35\\Scripts 例如,我将其值更改为C:\\Users\\rgupta6\\AppData\\Local\\Programs\\Python\\Python35\\Scripts

  1. Close all remaining windows. 关闭所有剩余的窗口。 Reopen Command prompt window, and run your pip3 install --upgrade tensorflow command or pip3 install tensorflow command 重新打开命令提示符窗口,并运行pip3 install --upgrade tensorflow命令或pip3 install tensorflow命令

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 我有同样的问题,我发现他的答案很有帮助

  1. Right click on This PC > Select Properties 右键单击“此PC”>“选择属性”
  2. Select Advanced system settings on the left 选择左侧的高级系统设置
  3. In the dialog box select Environment Variables 在对话框中选择Environment Variables
  4. In the system variables section select path and cllck on edit 在系统变量部分中选择路径并编辑cllck
  5. 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

  1. Then ok.. to all the boxes opened 然后确定..打开所有的盒子
  2. Close cmd if it is already open and now try installing tensorflow using pip again like this 关闭cmd,如果它已经打开,现在尝试再次使用pip安装tensorflow,就像这样
 pip3 install --upgrade tensorflow

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. 注意64 bit部分。
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). 您将安装tensorflow-1.0.1-cp35-cp35m-win_amd64.whl ,因此请仔细检查您的正确版本(大多数情况下,您都会遇到Python 2.7和3.5)。

when installing python, on the install window, check the box "Active path"(something like that), which builds up a path link. 安装python时,在安装窗口中,选中“Active path”(类似的东西)框,它会构建一个路径链接。 So you can run "pip3 install" at anywhere. 所以你可以在任何地方运行“pip3 install”。

Typing the python command before that should do the trick. 在此之前键入python命令应该可以解决问题。 In my case (on Windows 8.1 with Python 3.6), I had to type 'py' instead of 'python' as follows: 在我的情况下(在带有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. 答案取决于您使用的系统。

The issue is your path in the cmd is not that of where your python scripts are placed. 问题是您在cmd中的路径不是放置python脚本的路径。 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. 在这种情况下,您可以在终端中导航到“AppData \\ Local \\ Programs \\ Python \\ Python36 \\ Scripts”然后运行命令,或者您只需将C:\\ Users \\ Your User Name \\ AppData \\ Local \\ Programs \\ Python \\ Python36 \\ Scripts to Path变量。

Then re-launch your cmd and type "pip3 install tensorflow" and see the feel the happiness :) 然后重新启动你的cmd并输入“pip3 install tensorflow”,看看感觉幸福:)

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. 我刚刚遇到了同样的问题,很可能你下载了一个压缩版本的python,然后解压缩它,并将它添加到$ PATH就像我一样,python可以工作但是pip3不能,而python -m pip也不能。 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的可执行版本,然后按照常见的安装步骤,默认选择pip3,然后现在一切正常。

暂无
暂无

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

相关问题 安装tensorflow,得到错误'pip3',未被识别为内部或外部命令,可操作程序或批处理文件” - Installing tensorflow, getting error 'pip3' is not recognized as an internal or external command, operable program or batch file" 'pip3' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'pip3' is not recognized as an internal or external command, operable program or batch file pip 在 windows7 中未被识别为内部或外部命令 - pip is not recognized as an internal or external command in windows7 如何解决python/pip/pip3 不识别为内部或外部命令 | 更改路径后 python 命令错误? - How to solve python/pip/pip3 is not recognized as an internal or external command | python command error after changing path? 'pip' 未被识别为内部或外部命令 - 'pip' is not recognized as an internal or external command 'pip2' 未被识别为内部或外部命令 - 'pip2' is not recognized as an internal or external command 无法解决“ pip”问题的方法未被识别为内部或外部命令 - No way to fix 'pip' is not recognized as an internal or external command Python 2.7 'Pip' 不被识别为内部或外部命令 - Python 2.7 'Pip' is not recognized as an internal or external command 'scrapy' 安装后不被识别为内部或外部命令 - 'scrapy' is not recognized as an internal or external command after installation "Heroku 未被识别为内部或外部命令 (Windows)" - Heroku not recognized as an internal or external command (Windows)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM