本文介绍了没有安装Python 3.4和2.7,没有安装Script文件夹,也没有安装pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天在Win7 X64上为Python 2.7.93.4.3进行全新安装,我发现Python27Python34文件夹中没有Script文件夹作为第一个子级文件夹,但是Tools中有一个.但是,尽管默认情况下应该将pipPython一起安装,但在该Script文件夹中找不到pip.另一个我正在为其他PC和笔记本电脑进行相同的安装,其中有Script文件夹(作为Python27Python34中的第一级子文件夹),其中包含pip.那么发生了什么?如何以这种方式安装pip以及其他有用的脚本?

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?

我在Python34中尝试了python -m ensurepip.我遇到以下错误:

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

问题是由于HKEY_LOCAL_MACHINE中的多个空注册表项导致mimetypes.py中的read_windows_registry()搜索失败.这是导致解决方案的帖子:

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和Windows注册表损坏

谢谢

推荐答案

如果使用PSF(python.org).msi Windows安装程序,则pip(和依赖项)应安装在pythonxy/Lib/site-packages中,用于3.4 .0+和2.7.9+.还应该有包含大约5个.exes的pythonxy/Scripts.这是安装过程的最后一部分.命令提示符窗口应短暂出现.也许您在安装时没有检查[] install pip(尽管默认情况下应该已检查).也许您错过了一个错误.

If you used the PSF (python.org) .msi Windows installers, pip (and dependencies) should be installed in pythonxy/Lib/site-packages for 3.4.0+ and 2.7.9+. There should also be pythonxy/Scripts containing about 5 .exes. This is the last part of the install process. A command prompt window should briefly appear. Perhaps you did not have [ ] install pip checked when doing the installs (although this should have been checked by default). Perhaps there was an error that you missed.

无论如何,对于2.7和3.4,都应该有pythonxy/Lib/ensurepip/*,并且现在应该可以运行此模块.在命令提示符中,在.../python27和.../python34中都尝试python -m ensurepip.

In any case, you should have pythonxy/Lib/ensurepip/* present for both 2.7 and 3.4 and you should be able to run this module now. In Command Prompt, try python -m ensurepip in both .../python27 and .../python34.

这篇关于没有安装Python 3.4和2.7,没有安装Script文件夹,也没有安装pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 04:00