在MINGW64上点对点?

时间:2019-07-08 07:49:36

标签: python pip windows-10 mingw-w64

我试图在Windows 10计算机上通过MSYS2 Shell安装Jupyter(根据https://jupyter.org/install,“使用pip安装Jupyter”)-进程崩溃;然后我发现了这个:

jupyter notebook fails to start · Issue #1540 · msys2/MSYS2-packages · GitHub

  

您需要从mingw64 shell(而不是msys2 shell)启动jupyter notebook。   对我来说,一个简单的jupyter笔记本可以按预期工作。

好,所以我想尝试MINGW64 shell。

注意,在MSYS2 shell中:

user@DESKTOP-PC MSYS /c/
$ python3 -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 2.3MB/s
Installing collected packages: pip
  Found existing installation: pip 19.1
    Uninstalling pip-19.1:
      Successfully uninstalled pip-19.1
Successfully installed pip-19.1.1

因此,pip在MSYS2 shell中可以正常工作。但是,如果我尝试使用MINGW64:

user@DESKTOP-PC MINGW64 ~
$ python3 -m pip install jupyter
C:/msys64/mingw64/bin/python3.exe: No module named pip

user@DESKTOP-PC MINGW64 ~
$ python2 -m pip install --upgrade pip
C:/msys64/mingw64/bin/python2.exe: No module named pip

注意上面在MINGW64 shell中python的路径;如果我们尝试查看MSYS2中Python的路径是什么,则有所不同:

user@DESKTOP-PC MSYS /c/
$ which python3
/usr/bin/python3

user@DESKTOP-PC MSYS /c/
$ cygpath -w `which python3`
C:\msys64\usr\bin\python3.exe

无论如何-我可以在Windows 10的MINGW64 shell中为pip使用python吗?


编辑:刚尝试在MINGW64中使用python3安装pip-不起作用:

user@PC MINGW64 /c/Users/user/Desktop
$ python3 get-pip.py
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
     |################################| 1.4MB 1.7MB/s
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: pip, wheel
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\cli\base_command.py", line 178, in main
    status = self.run(options, args)
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\commands\install.py", line 414, in run
    use_user_site=options.use_user_site,
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\req\__init__.py", line 58, in install_given_reqs
    **kwargs
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\req\req_install.py", line 922, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\req\req_install.py", line 448, in move_wheel_files
    warn_script_location=warn_script_location,
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_internal\wheel.py", line 544, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_vendor\distlib\scripts.py", line 405, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_vendor\distlib\scripts.py", line 309, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_vendor\distlib\scripts.py", line 245, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\user\AppData\Local\Temp\tmp4b0z8ro2\pip.zip\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

2 个答案:

答案 0 :(得分:2)

对于Mingw-64,pip会在程序包的下游进行修补。要安装软件包,请运行: pacman -S mingw-w64-x86_64-python-pip

然后,您应该可以使用python -m pip安装jupyter和其他软件包,但是避免运行python -m pip --upgrade pip,因为这将覆盖打包的版本。

我还建议通过运行python -m venv .venvsource .venv/bin/activate使用virtualenv来使pip安装的软件包完全分开。

答案 1 :(得分:-1)

您可以使用pacman安装它:

compute

如果您需要git:

n = int(input())
a = "_"
b = "|"
for i in range(0,n,1):
    if i == 0:
        print(" " * (2*n - 1) + "_*_")
        print(" " * 2*((n - 1)) + b + " " * 3 + b)
    else:
        print(" " * ((2*n - 1) - 2*i) + a + (" " * ((i + 1) * 4 - 3) ) + a)
        print(" " * ((2*(n-1)) - 2*i)  + b + (" " * ((i + 1)*4 - 1)) + b)