I have a Python 2.7.11 installed on one of my LAB stations. I would like to upgrade Python to at least 3.5.
How should I do that ?
Should I prefer to completely uninstall 2.7.11 and than install the new one ?
Is there a way to update it ? Is an update a good idea ?
Every minor version of Python, that is any 3.x and 2.x version, will install side-by-side with other versions on your computer. Only patch versions will upgrade existing installations.
So if you want to keep your installed Python 2.7 around, then just let it and install a new version using the installer. If you want to get rid of Python 2.7, you can uninstall it before or after installing a newer version—there is no difference to this.
Current Python 3 installations come with the py.exe launcher, which by default is installed into the system directory. This makes it available from the PATH, so you can automatically run it from any shell just by using py instead of python as the command. This avoids you having to put the current Python installation into PATH yourself. That way, you can easily have multiple Python installations side-by-side without them interfering with each other. When running, just use py script.py instead of python script.py to use the launcher. You can also specify a version using for example py -3 or py -3.6 to launch a specific version, otherwise the launcher will use the current default (which will usually be the latest 3.x).
Using the launcher, you can also run Python 2 scripts (which are often syntax incompatible to Python 3), if you decide to keep your Python 2.7 installation. Just use py -2 script.py to launch a script.
As for PyPI packages, every Python installation comes with its own folder where modules are installed into. So if you install a new version and you want to use modules you installed for a previous version, you will have to install them first for the new version. Current versions of the installer also offer you to install pip; it’s enabled by default, so you already have pip for every installation. Unless you explicitly add a Python installation to the PATH, you cannot just use pip though. Luckily, you can also simply use the py.exe launcher for this: py -m pip runs pip. So for example to install Beautiful Soup for Python 3.6, you could run py -3.6 -m pip install beautifulsoup4.
If you are upgrading any 3.x.y to 3.x.z (patch) Python version, just go to Python downloads page get the latest version and start the installation. Since you already have Python installed on your machine installer will prompt you for "Upgrade Now". Click on that button and it will replace the existing version with a new one. You also will have to restart a computer after installation.
If you are upgrading from 3.x to 3.y (minor) then you will be prompted with "Install Now". In this case, you are not upgrading, but you are installing a new version of Python. You can have more than one version installed on your machine. They will be located in different directories. When you have more than one Python version on your machine you will need to use py lanucher to launch a specific version of Python.
For instance:
py -3.7
or
py -3.8
Make sure you have py launcher installed on your machine. It will be installed automatically if you are using default settings of windows installer. You can always check it if you click on "Customize installation" link on the installation window.
If you have several Python versions installed on your machine and you have a project that is using the previous version of Python using virtual environment e.g. (venv) you can upgrade Python just in that venv using:
python -m venv --upgrade "your virtual environment path"
For instance, I have Python 3.7 in my ./venv virtual environment and I would like upgrade venv to Python 3.8, I would do following
python -m venv --upgrade ./venv
Installing/Upgrading Python Using the Chocolatey Windows Package Manager
Let's say you have Python 2.7.16:
C:\Windows\system32>python --version
python2 2.7.16
...and you want to upgrade to the (now current) 3.x.y version. There is a simple way to install a parallel installation of Python 3.x.y using a Windows package management tool.
Now that modern Windows has package management, just like Debian Linux distributions have apt-get, and RedHat has dnf: we can put it to work for us! It's called Chocolatey.
What's Chocolatey?
Chocolatey is a scriptable, command line tool that is based on .NET 4.0 and the nuget package manager baked into Visual Studio.
If you want to learn about Chocolatey and why to use it, which some here reading this might find particularly useful, go to https://chocolatey.org/docs/why
Installing Chocolatey
To get the Chocolatey Package Manager, you follow a process that is described at https://chocolatey.org/docs/installation#installing-chocolatey,
I'll summarize it for you here. There are basically two options: using the cmd prompt, or using the PowerShell prompt.
CMD Prompt Chocolatey Installation
Launch an administrative command prompt. On Windows 10, to do this:
Windows + R
Type cmd
Press Ctrl + ⇧ Shift + ↵ Return
If you don't have administrator rights on the system, go to the Chocolatey website. You may not be completely out of luck and can perform a limited local install, but I won't cover that here.
Copy the string below into your command prompt and type Enter:
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Chocolatey will be downloaded and installed for you as below:
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\blahblahblah\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\blahblahblah\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
(i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
Creating Chocolatey folders if they do not already exist.
WARNING: You can safely ignore errors related to missing log files when
upgrading from a version of Chocolatey less than 0.9.9.
'Batch file could not be found' is also safe to ignore.
'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\blahblahblah\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
Either Exit the CMD prompt or type the following command to reload the environment variables:
refreshenv
PowerShell Chocolatey Installation
If you prefer PowerShell to the cmd prompt, you can do this directly from there, however you will have to tell PowerShell to run with a proper script execution policy to get it to work. On Windows 10, the simplest way I have found to do this is to type the following into the Cortana search bar next to the Windows button:
PowerShell.exe
Next, right click on the 'Best Match' choice in the menu that pops up and select 'Run as Administrator'
Now that you're in PowerShell, hopefully running with Administrator privileges, execute the following to install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
PowerShell will download Chocolatey for you and launch the installation. It only takes a few moments. It looks exactly like the CMD installation, save perhaps some fancy colored text.
Either Exit PowerShell or type the following command to reload the environment variables:
refreshenv
Upgrading Python
The choco command is the same whether you use PowerShell or the cmd prompt. Launch your favorite using the instructions as above. I'll use the administrator cmd prompt:
C:\WINDOWS\system32>choco upgrade python -y
Essentially, chocolatey will tell you "Hey, Python isn't installed" since you're coming from 2.7.x and it treats the 2.7 version as completely separate. It is only going to give you the most current version, 3.x.y (as of this writing, 3.7.2, but that will change in a few months):
Chocolatey v0.10.11
Upgrading the following packages:
python
By upgrading you accept licenses for the packages.
python is not installed. Installing...
python3 v3.x.y [Approved]
python3 package files upgrade completed. Performing other installation steps.
Installing 64-bit python3...
python3 has been installed.
Installed to: 'C:\Python37'
python3 can be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type `refreshenv`).
The upgrade of python3 was successful.
Software installed as 'exe', install location is likely default.
python v3.x.y [Approved]
python package files upgrade completed. Performing other installation steps.
The upgrade of python was successful.
Software install location not explicitly set, could be in package or
default install location if installer.
Chocolatey upgraded 2/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Either exit out of the cmd/Powershell prompt and re-enter it, or use refreshenv then type py --version
C:\Windows\System32>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
C:\Windows\system32>py --version
Python 3.7.2
Note that the most recent Python install will now take over when you type Python at the command line. You can run either version by using the following commands:
py -2
Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\>py -3
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>exit()
C:\>
From here I suggest you use the Python pip utility to install whatever packages you need. For example, let's say you wanted to install Flask. The commands below first upgrade pip, then install Flask
C:\>py -3 -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.6MB/s
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3
c:\>py -3 -m pip install Flask
...will do the trick. Happy Pythoning!
A quick and painless way for me was to do the following:
Do a pip freeze > requirements.txt on my affected environments (or whatever method you want for backing up your requirements)
Remove the Old version of Python (in my case it was 3.8)
Remove the associated environments
Install the new version (3.9.5 in my case)
Recreate my environments python -m venv venv or however you wish
Reinstall my plug-ins/apps pip install -r requirements.txt or however you wish
Python 2.x and Python 3.x are different. If you would like to download a newer version of Python 2, you could just download and install the newer version.
If you want to install Python 3, you could install Python 3 separately then change the path for Python 2.x to Python 3.x in Control Panel > All Control Panel Items > System > Advanced System Settings > Environment Variables.
In 2019, you can install using chocolatey. Open your cmd or powershell, type:
choco install python
Nowadays you can just install several Python versions from Microsoft Store. Those are published there by Python Software Foundation.
https://apps.microsoft.com/store/search?hl=en-en&gl=EN&publisher=Python%20Software%20Foundation
Just install python newest version's installer it will automatically detect your python version and will say upgrade python and starts upgrading
I was able to execute PowerShell with the following command and python upgraded with no issue. python -m pip install --upgrade pip please see image
You can use pyenv. It let you easily switch between all versions of python.
Related
I have in windows 10 64 bit installed python 3.9 with site-packages. I would like to install python 3.10.2 on windows 10 64 bit and find a way to install packages automatically in python 3.10.2, the same ones I currently have installed in python 3.9. I am also interested in the answer to this question for windows 11 64 bit.
I upgraded to python 3.10.2 in windows 10 64 bit. To properly install the packages, install the appropriate version of the Microsoft Visual C++ compiler if necessary. Details can be read https://wiki.python.org/moin/WindowsCompilers . With the upgrade to python 3.10.2 from 3.9, it turned out that I had to do it, due to errors that are appearing during the installation of the packages. Before the installing python 3.10.2, type and execute the following command in the windows command prompt:
pip freeze > reqs.txt
This command writes to the reqs.txt file the names of all installed packages in the version suitable for pip. If you run the command prompt with administrator privileges, the reqs.txt file will be saved in the directory C:\WINDOWS\system32.
Then, after the installing of python 3.10.2 and the adding it to the paths in PATH, with the help of the command prompt you need to issue the command:
pip install -r reqs.txt
This will start the installing of the packages in the same versions as for python 3.9. If problems occur, e.g. an installation error appears during the installation of lxml, then you can remove from the regs.txt file the entry with the name of the package whose installation is causing the problem and then install it manually. To edit the reqs.txt file you need the administrator privileges. The easiest way is to run the command prompt in the administrator mode, type reqs.txt and click Enter to edit it.
I decided later to update the missing packages to the latest version, because I suspected that with python 3.10.2 older versions were not compatible.
This means that when upgrading to python 3.10.2 it is worth asking yourself whether it is better to upgrade for all packages. To do this, you can generate the list of the outdated packages using the command:
pip list –-outdated
After the printing of the list in the command prompt, you can upgrade the outdated packages using the command:
pip install --upgrade <package-name>
This can be automated by the editing of the reqs.txt file and the changing of the mark == to > which will speed up the upgrade. The mark > should only be changed for the outdated packages or you will get an error: "Could not find a version that satisfies the requirement ... ".
Supplement to virtual environments:
When you enter a virtual environment directory (in the windows command prompt):, such as D:\python_projects\data_visualization\env\Scripts, type activate to activate it. Then create the reqs.txt file analogous to the description above. Then, copy the file to a temporary directory. After this delete the virtual environment, e.g. using the windows explorator by the deleting of the contents of the env directory. Then, using the version of python in windows of our choice, create a virtual environment using the env directory (see: https://docs.python.org/3/library/venv.html). Copy the regs.txt file to the newly created D:\python_projects\data_visualization\env\Scripts directory. Install site-packages with the support of the regs.txt file as described above.
No you need not reinstall python packages.
conda create --name project-env python=3.x
You can also look at an alternative method to install python versions Install python version
I'm using msys2 for my dev environment on Windows 10. It's great, and this is the first roadblock I've come up against.
Specifically I'm trying to install some packages that won't allow me to via pip because my platform is incorrect. They require a 3.6 platform and msys2 comes with 3.7
I tried pyenv-win, but that wouldn't seem to work within cmder and it also installed some full windows installers of python 3.6.
Is there a recommended way to get another version of python installed using the msys ecosystem of command lines?
I know you want to use msys2, but you should reconsider, the majority of implementation don’t use msys2. multiple versions and multiple environments can get complicated. If you choose to go forward in a more standard way, you could use what I have written below
You can’t create a virtual env with a version of python that isn’t install in your system.
Downloaded and install the version of python you want to use, from https://www.python.org/
Create a project folder
Create a venv calling the newly installed version of python
venv is part of the standard library
c:\>python -3.x -m venv c:\path\to\myenv
it created a copy of the python executable in the newly created venv
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
Activate the new env
c:\> c:\path\to\myenv\Scripts\activate.bat
(venv) path\to\myenv>
Once activated you can pip install
(venv) path\to\myenv> pip install [package.name]
(venv) path\to\myenv> pip list
Any script you run from that venv will used the python exe installed in that virtual environment and use the packages you just installed there
I'm using Python 3.6 through Spyder in Anaconda3.
I have both the Anaconda installation and a "clean" python installation.
Before I installed the "clean" python, when I ran the Python -V command in cmd I got the following version description Python 3.6.5 :: Anaconda, Inc. Now when I run the command it just says Python 3.6.5. and the pip list is a whole lot shorter.
When ever I open Spyder and find some package that I don't have... how would I go about installing said package?
If I just open cmd and write pip install ... it will install in the "clean" python directory.
How do I tell it to connect to Spyder?
I know it's a very late answer, but it may help other people.
When you are working with anaconda you can use the basic environement or create a new one (it may be what's you call a "clean" python installation). To do that just do the following :
Open you anaconda navigator
Go to "Environments"
Click on the button create. Here by the way you can choose you python version
Then to install your lib you can use your Anaconda GUI :
Double click on you environment
On the right side you have all you installed lib. In the list box select "Not installed"
Look for your lib, check it and click on "apply" on the bottom right
You can also do it in your windows console (cmd), I prefer this way (more trust and you can see what's going on) :
Open you console
conda activate yourEnvName
conda install -n yourEnvName yourLib
Only if your conda install did not find your lib do pip install yourLib
At the end conda deactivate
/!\ If you are using this way, close your Anaconda GUI while you are doing this
If you want you can find your environement(s) in (on Windows) C:\Users\XxUserNamexX\AppData\Local\Continuum\anaconda3\envs. Each folder will contains the library for the named environement.
Hope it will be helpfull
PS : Note that it is important to launch spyder through the Anaconda GUI if you want Spyder to find your lib
If you are using Spyder IDE easiest procedure which i found to install PIP is -:
Step 1- Check if Python is installed correctly.
The simplest way to test for a Python installation on your Windows server is to open a command prompt (click on the Windows icon and type cmd, then click on the command prompt icon). Once a command prompt window opens, type python and press Enter. If Python is installed correctly, you should see output similar to what is shown below:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Step 2-: Now in Step 2
Once you’ve confirmed that Python is correctly installed, you can proceed with installing Pip.
Download get-pip.py
https://bootstrap.pypa.io/get-pip.py
to a folder on your computer.
Open a command prompt and navigate to the folder containing get-pip.py.
Run the following command:
python get-pip.py
Pip is now installed!
You can verify that Pip was installed correctly by opening a command prompt and entering the following command:
pip -V
You should see output similar to the following:
pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)enter code here
There is a pip.exe included in the anaconda/Spyder package which can cleanly add mopdules to Spyder. It's not installed in the windows path by default, probably so it' won't interfere with the "normal" pip in my "normal" python package.
Check "/c/Users/myname/Anaconda3/Scripts/pip.exe". It seems to depend on local DLLs - it did not work (just hung) until I cd'd into it's directory. Once there I used it to install pymongo in the usual way, and the pymongo package was picked up by Spyder.
Hope that helps...
I installed spyder without anaconda on linux, and i was missing a module, all i did was installing pip on the linux terminal
sudo apt install python3-pip and then pip install "the library name "
and it worked in spyder without any other modification.
I'm trying to use the Python GUI wx (installable via pip install wxPython) in the following minimal app:
import wx
app = wx.App()
Running this snippet returns the following:
This program needs access to the screen. Please run with a Framework
build of python, and only when you are logged in on the main display
of your Mac.
Does anyone know how to help wx gain "access to the screen", or what a "Framework build of Python" is? I'd be grateful for any help others can offer with these questions!
wxPython on Mac within a virtual environment throws this error, as explained by wxPython website here: https://wiki.wxpython.org/wxPythonVirtualenvOnMac
If you are not running it in a virtual environment and still receive this error, try running your script that uses wxpython with "pythonw" instead of "python". Ex:
pythonw hello.py
^See section "4.1.2 Running Scripts with a GUI" (on MacOS) from the following page in the Python Docs to see this python quirk explained: https://docs.python.org/3/using/mac.html
This resolves the problem, but it can't be the prettiest solution:
# install anaconda
install anaconda
# uninstall all versions of pythonWx
pip uninstall pythonWx -y
conda remove pythonwx
# install the python.app binary through conda
conda install python.app
# determine where the conda binary lives
which conda
# that previous command returns something like:
# /Users/yaledhlab/anaconda3/bin/conda
# replace the /conda with /python.app
# and run the result in a terminal
/Users/yaledhlab/anaconda3/bin/python.app
# that should open a Python terminal (you know you're in the Python
# terminal if you see >>> as a prefix for your shell)
# import the python package manager and install wxPython to
# your python.app version of Python
import pip
pip.main(['install', 'wxPython'])
# exit the python interpreter
exit()
# run the program
/Users/yaledhlab/anaconda3/bin/python.app main.py
I ran into the same problem. In order to use anaconda's python executable and wxPython on a mac you will need to run "pythonw" (instead of "python"). This calls the python executable that is compatible with wxPython. But in order to get it to work on my mac I had to update my anaconda packages by running:
conda install anaconda #you might not need this if anaconda is up to date
followed by:
conda install wxPython
which installs the "pythonw" executable in the "//anaconda3/bin" directory (you might have anaconda installed somewhere else). Then I could run any "program_with_xwPython.py" that imports/contains and uses wx using "pythonw" as follows:
pythonw program_with_xwPython.py # Note: 'python program_with_xwPython.py' gives the error still, you need to run 'pythonw'
You can then also launch a python REPL (i.e the >>> prompt) that works with wxPython using:
pythonw # instead of 'python'
This let's you import wx and run wx apps with the python CLI. It's been working like a champ for me.
I always had it working, including after update to Catalina and I never needed to run some silly pythonw instead of python and had all my wx-enabled scripts running correctly.
At some time something broke in my environment, I think it was the pip-tools that without any warning started to remove my packages. Not sure what happened but damage has been done and suddenly I saw the infamous
This program needs access to the screen. Please run with a Framework
build of python, and only when you are logged in on the main display
of your Mac.
I manage my environments with pyenv, the current python environment was 3.4.7. Let the script from the question be tst.py, I run
$ python tst.py
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
I make sure the wxpython is installed with brew
$ brew info wxpython
wxpython: stable 4.1.1 (bottled)
Python bindings for wxWidgets
https://www.wxpython.org/
/usr/local/Cellar/wxpython/4.1.1 (1,227 files, 91.8MB) *
Poured from bottle on 2021-03-04 at 14:52:18
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/wxpython.rb
License: LGPL-2.0-or-later with WxWindows-exception-3.1
==> Dependencies
Required: freetype ✔, jpeg ✔, libpng ✔, libtiff ✔, numpy ✔, python#3.9 ✔
==> Analytics
install: 643 (30 days), 2,701 (90 days), 12,659 (365 days)
install-on-request: 604 (30 days), 2,523 (90 days), 9,914 (365 days)
build-error: 0 (30 days)
The wxPython wiki suggests
The reason is because some 3rd party tools like PyInstaller might require CPython installation be built with --enable-framework. What you need to do is run $ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.x.x in your terminal.
so I re-installed 3.7.4 from scratch
$ pyenv uninstall 3.7.4
$ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.4
and tried the script again
$ python tst.py
2021-03-04 15:14:44.138 Python[18815:404240] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
of course it does not completely resolves it but at least the annoying error is gone...
Official wxPython website has a solution:
If you're using conda:
>> conda install python.app # this will install latest pythonw
>> pythonw your_app.py
$ pyenv uninstall 3.9.2
$ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.9.2
Solved the problem for me with my pyenv installation on Mac
#duhaime
There is an installer for OSX on the official wxPython web-site.
Just download it and install.
You don't need to play with anaconda just to install and run such a simple application.
When following the Installing TensorFlow for Windows guide https://www.tensorflow.org/install/install_windows, after executing
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)
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).
This will work, if you are facing pip3 or pip is not recognized as an internal or external command issue on 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.
For e.g. I changed its value to 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 or pip3 install tensorflow command
That is because you haven't setup the environment variable yet.
Follow the steps by #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..
it is mostly in C:\Users[your user name]\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
pip3 install --upgrade tensorflow
Before running pip3 install --upgrade tensorflow
you need check if you are using the correct Python 3.5 installation:
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).
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.
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:
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. 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.
Then re-launch your cmd and type "pip3 install tensorflow" and see the feel the happiness :)
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.