【问题标题】:Installing Pip on Msys在 Msys 上安装 Pip
【发布时间】:2018-06-13 16:42:08
【问题描述】:

我已经使用 Python 3.5.2 和 Msys 构建了一个简单的 PyGTK 应用程序,但我需要一些默认安装中没有的模块,虽然我可以使用 setup.py install 来获取它们,但我更愿意使用 pip

我环顾四周,发现 this 但它与 Python 2 相关,并在尝试按照给出的说明进行操作时出错:

$ python3 getpip.py

Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
Collecting setuptools
  Using cached setuptools-38.2.5-py2.py3-none-any.whl
Collecting wheel
  Using cached wheel-0.30.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Exception:
Traceback (most recent call last):
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\wheel.py", line 462, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\_vendor\distlib\scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\_vendor\distlib\scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\_vendor\distlib\scripts.py", line 212, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\Simon\AppData\Local\Temp\tmpoumuod3r\pip.zip\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

我尝试了在 Linux 上安装 pip 的方法:

pacman -S python2-pip           
pacman -S python-pip           

列出的here,以及:

pacman -S python3-pip

但每次我收到error: target not found: 错误。

令人惊讶的是,我找不到其他任何东西。

那么我如何在 Msys 上获得pip

谢谢。

【问题讨论】:

标签: python python-3.x pip msys


【解决方案1】:

要安装 pip,请安全下载get-pip.py

然后运行以下命令:

python get-pip.py

更多详情请参考:https://pip.pypa.io/en/stable/installing/

【讨论】:

  • OP 已经在使用getpip.py,并且似乎需要 Python 3。我不确定您的复制/粘贴是否有帮助:/
  • 在msys2中,安装python时pip不作为默认包的一部分安装(安装的python版本为3.6.2)。使用 pacman 安装没有产生任何结果,出现错误:找不到目标:错误。因此,从位置手动下载文件以安装 pip (9.0.3)。
【解决方案2】:

请注意,此时以下命令正在 msys2 上运行:

$ pacman -S python3-pip
$ pip3 install --upgrade pip

【讨论】:

  • 你是对的。我最近更新了我的 MSYS2 安装,这很奏效,谢谢 :)
  • 这是有效的,但安装了一个新的 Python 可执行文件,没有 GTK 库。如何让 GTK 和 Pip 具有相同的 Python 可执行文件?
【解决方案3】:

接受的答案是使用pip 安装一个新的 Python 可执行文件,但不支持 GTK。

为了给现有的 GTK Python 可执行文件安装pip 支持,遇到该错误后,我们需要运行:

python -m pip install -U --force-reinstall pip

(取自this issue

总结将 Pip 支持安装到 GTK-Python 可执行文件所需的步骤:

  1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  2. python get-pip.py
  3. (忽略上一步的错误)
  4. python -m pip install -U --force-reinstall pip

【讨论】:

    猜你喜欢
    • 2014-04-27
    • 2017-07-09
    • 2016-11-04
    • 2013-07-07
    • 2017-06-19
    • 2021-09-16
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多