使用PIP安装TENSORFLOW时出错:pip3未被系统识别
Hey there, let's get that pip3 issue sorted out so you can install TensorFlow. This is a super common problem when Python's executable path isn't added to your system's environment variables. Here are the steps to fix it:
Quick Temporary Fix (Install TensorFlow Right Away)
If you just want to get TensorFlow installed first without messing with environment variables, you can run pip3 using its full file path.
- First, find your Python 3.6.5 installation folder. By default, it's usually
C:\Python36(since Python 3.6.5 uses this default path on Windows). - Navigate to the
Scriptssubfolder inside that directory—this is wherepip3.exelives. - In Command Prompt, run the full command:
C:\Python36\Scripts\pip3 install --upgrade tensorflow
This should work immediately, but we'll fix the root cause next so you don't have to type the full path every time.
Permanent Fix: Add Python Scripts to System Environment Variables
This will make pip3 (and other Python tools) accessible from any Command Prompt window:
- Right-click on Computer (or This PC) and select Properties.
- Click Advanced system settings on the left sidebar.
- In the pop-up window, go to the Advanced tab and click Environment Variables.
- Under System variables, scroll down and find the
Pathvariable, then click Edit. - Add the full path to your Python Scripts folder at the end of the list. If your Python is installed in the default location, this is:
Note: Make sure to add a semicolon (;C:\Python36\Scripts;) before the path if it's not already present at the end of the existing Path value. - Click OK on all open windows to save the changes.
- Close any open Command Prompt windows and open a new one—now running
pip3 --versionshould work, and you can use the original commandpip3 install --upgrade tensorflowwithout issues.
Bonus Check: Try Using pip Instead of pip3
On some Windows Python installations, the pip command is already linked to Python 3's pip (instead of Python 2, if you don't have it installed). You can test this by running:
pip install --upgrade tensorflow
If that works, you can stick with pip for future commands instead of pip3.
If you ever reinstall Python, make sure to check the box that says Add Python to PATH during the installation process—this will automatically set up the environment variables for you, so you won't run into this issue again.
内容的提问来源于stack exchange,提问作者Clint4Life

