Python 3.4 and 2.7 installation no Script folder a

2019-03-23 04:04发布

I was doing a fresh installation for Python 2.7.9 and 3.4.3 on Win7 X64 today, and I found that there is no Script folder in Python27 and Python34 folder as first child level folder, but there is one in Tools. However, I couldn't find pip within that Script folder, although pip should be installed with Python by default. The other I was doing the same installation for my other PC and laptop, there was Script folder (as first level child folder in Python27 and Python34) containing pip. So what is going on? how to install pip and maybe other useful scripts this way?

[EDIT] I tried python -m ensurepip in Python34. I got the following errors:

Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
 Exception:
 Traceback (most recent call last):
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\basecommand.py", line 232, in main
  status = self.run(options, args)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\commands\install.py", line 339, in run
  requirement_set.prepare_files(finder)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\req\req_set.py", line 333, in prepare_files
  upgrade=self.upgrade,
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 326, in find_requirement
  file_locations, url_locations = self._sort_locations(locations)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 158, in _sort_locations
  sort_path(os.path.join(path, item))
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 139, in sort_path
  if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
File "C:\Python34\lib\mimetypes.py", line 287, in guess_type
  init()
File "C:\Python34\lib\mimetypes.py", line 348, in init
  db.read_windows_registry()
File "C:\Python34\lib\mimetypes.py", line 255, in read_windows_registry
  with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or None,  not str

[EDIT] The problem is due to multiple null Registry keys in HKEY_LOCAL_MACHINE that make read_windows_registry() in mimetypes.py searches failed. Here is the post that leads to the solution:

Python ‘pip’ and Windows registry corruption

thanks

13条回答
一纸荒年 Trace。
2楼-- · 2019-03-23 04:29

Based on a combination of whats here, and what I found elsewhere, here is how I fixed it:

Uninstall whatever is installed already. Go to regedit and HKLM/SOFTWARE/Python and delete the whole python section. Reinstall Python

This installed with the scripts folder this time.

Hope this helps someone.

查看更多
手持菜刀,她持情操
3楼-- · 2019-03-23 04:30
家丑人穷心不美
4楼-- · 2019-03-23 04:30

It is permission issue. I have both python 2 and 3 installed under

C:\Program Files\python\2.7.16

C:\Program Files\python\3.7.2

Python 2 installer is msi, so there is no run as admin option when install it

Python 3 installer is exe, there is run as admin option.

As the results, python 2 installed without scripts and pip.exe and python 3 installed successfully.

To fix this, simply give the full permission to everyone on

C:\Program Files\python\ and install python 2 again. then change the permission back.

That's it.

查看更多
我想做一个坏孩纸
5楼-- · 2019-03-23 04:33

I ran into the same issue today while trying to install Python 2.7.13 in my computer; after some investigation I realized that v.3.60 ("Anaconda") was already present (it came along with Microsoft Visual Studio 2017, which I've installed a couple weeks ago).

I suspected of some path mismatch in the registry, so I tried removing both Python v. 3.60 and 2.17, and cleaning up the Registry by deleting the HKCU\Software\Python key (which, due to some reason, was still present). After this, I was able to correctly install version 2.7.13, and this time the \scripts folder is present, with all the expected contents.

I don't know if installing v. 3.6 again would cause any problem: I'm not going to try this for the time since I'm currently developing for v.2.7.

Hope this can be of some help, anyway.

Max - Italy


EDIT: I've made some further investigation and think I've discovered the reason why (in my case), the \Scripts folder was missing: the path where I was going to install Python is in virtual drive.

In my computer I only have one partition (C:), and i've mapped a folder (C:\Development) as D:, then I tried to install Python on D:\Python27; apparently this is not "good" and causes some problem in the installer.

After discovering that, I tried installing to the real path, and now everything seems to be OK.

Max.

查看更多
相关推荐>>
6楼-- · 2019-03-23 04:33

I had also faced the same problem which i managed to solve. The problem is when you install the python in default configuration then it installs the python folder in the "c:\user\Appdata......" which is lengthy and hard to find . To avoid it first uninstall the python 3.7 completely from the system from the control panel ->uninstall program. Then install it again with the option " customize installation". On the next page change the default location to C:/Python/Python37-32 and select the required check boxes and click install. This should solve your problem.

查看更多
我欲成王,谁敢阻挡
7楼-- · 2019-03-23 04:37

Windows 10. I had this issue while installing Python 2.7 into C:/Program Files/Python27 .. I think in this case it was a path issue. Fix was to do an install into C:/Python27, copy the Scripts folder from that installation to the installation in C:/Program Files/Python27. Everything else (including the paths to Python and Scripts) was fine.

查看更多
登录 后发表回答