明W64上的皮普?

2024-05-16 21:24:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图通过MSYS2 shell在一台Windows 10机器上安装Jupyter(根据https://jupyter.org/install,“Installing Jupyter with pip”)——但过程崩溃了;然后我发现:

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

You need to start jupyter notebook from the mingw64 shell, not from the msys2 shell. For me a simple jupyter notebook works as expected.

好吧,所以我想试试MINGW64外壳。在

注意,在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在msys2shell中工作得很好。但如果我试试MINGW64:

^{pr2}$

请注意上面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

无论如何,我能在Windows10上的mingw64shell中使用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'

Tags: installpipinpylocallinescriptzip