I cannot install numpy because it can't find python 2.7, althought I have installed python

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

I cannot install numpy because it can't find python 2.7, althought I have installed python.

I have message: "Python version 2.7 required, which can't find in registry"

Do have a solve of my problem?

回答1:

You should install Python 32bit, or use the numpy package for python 64bit from this unofficial site



回答2:

This is not uncommon with installers (e.g. Numpy) that depend on or look for a previously installed 64 bit core application (e.g. Python x64). The problem and solution are easy to explain.

PROBLEM IMHO this is an error on the part of the developer of the already-installed 64 bit applicaiton by placing the registry entry in the 32 bit node rather than (or in addition to) the 64 bit node. Actually, the developer of the installer could also code it to look in both locations as well, rather than just assuming the 64 bit application registry entry will be in \Wow6432Node, as a way of avoiding this problem of the original developer's oversight; however, if the installer bases its decision on whether the app is 32- or 64 bit based on the location of the registry entry (not a good idea), this could be problematic.

Occassionally with 64 bit applicaitons a registry entry will be created in...

HKLM\SOFTWARE\[applicaion name]

However, a corresponding registry entry is not created in...

HKLM\SOFTWARE\Wow6432Node\[application name]

SOLUTION The easiest way to resolve this with any applicaiton is to...

  1. Open the registry editor (START --> RUN --> regedit)
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\ [applicaiton name] (in this case "Python")
  3. Right click on the applicaiton ("Python")
  4. Select "Export" and save the file somewhere as "[application name].reg" ("Python.reg")
  5. Open the saved file with your editor of choice (I like Notepad++)
  6. On each entry right after "[HKEY_LOCAL_MACHINE\SOFTWARE" but before \ [applicaiton name] ("\Python"), add "\Wow6432Node" (without the quotes, obviously)
  7. Save the edited file as "[application name]_64.reg" (Python_64.reg")
  8. Close the editor and double-click on the newly created file, answer "Yes" to the Registry Editor verification popup.

Now you should have duplicate entries in HKLM\SOFTWARE\ [applicaiton name] and HKLM\SOFTWARE\Wow6432Node\ [applicaiton name]. Alternatively, you could manually create all the missing entries under HKLM\SOFTWARE\Wow6432Node\ [applicaiton name] to match what is in HKLM\SOFTWARE\ [application name], but that's really the long way around.

When you re-run the Numpy installer, it will now properly detect your 64 bit installation of Python.

CAVEAT There is a caveat to all this.

The duplicate entries in HKLM\SOFTWARE and HKLM\SOFTWARE\Wow6432Node are not a problem and will not affect normal operation of an application; however, as the developer missed creating the Wow6432Node registry entry, it's unlikely that any future updates that modify the registry entries will be populated in both locations. You may occassionally have to either perform this operation again or manually add new registry entries to the Wow6432Node in order to keep them consistent. An example where you might run into this is with the installation of Python modules that add an entry under HKLM\SOFTWARE\Python\PythonCore\2.x\Modules\ . You can export just the added entry and edit the .reg file to include "\Wow6432Node" only, export the entire \Python node and edit all entries (importing the edited .reg file will overwrite existing entries), or just manually add the new entry - whatever seems simpler to you.



回答3:

This problem also affects 32-bit numpy on 32-bit Python.

The cause is that the numpy installer assumes you opted for "install for all users" when you installed Python, i.e. that the Python installer used the machine-wide HKEY_LOCAL_MACHINE part of the registry. If you instead chose "install for me only", those registry settings are in the user-writable section of the registry, *HKEY_USERS_* (a.k.a. HKEY_CURRENT_USER). The numpy installer does not look there and therefore thinks that Python is not installed.

Solution: Copy the key HKEY_CURRENT_USER\Software\Python and all sub-keys to the corresponding place under HKEY_LOCAL_MACHINE\Software (you can do this with Export from regedit, then find&replace in the text file, then import). Or, reinstall Python and choose "all users".



回答4:

You have to mach the versions of python and numpy. Both need to be 32 bit or 64 bit.



回答5:

You should install python 2.7 32bit. The numerical python windows version are all 32bit.



回答6:

Uninstall Python from your system and reinstall once again . Then download numpy from this site : http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

In case you want to check the version of numpy on your system , write this following code on your IDE :

import numpy numpy.version.version

Hope this would help !



回答7:

  1. Run installer

  2. Click cancel when error shows up

  3. Click show details

  4. It will say at the end of the list Execute: C:\.........\numpy-1.7.1-sse3.exe, go to that folder, grab that file and drop it in C:\python27\

  5. Once it's in said folder, run it from that location. Setup will run and find it.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!