gpt4 book ai didi

python - 在 MINGW64 上 pip 赞?

转载 作者:行者123 更新时间:2023-12-03 17:13:34 51 4
gpt4 key购买 nike

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

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 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

无论如何 - 我可以使用 pippython在 Windows 10 上的 MINGW64 shell 中,如果是这样 - 如何?

编辑:刚刚尝试在 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'

最佳答案

使用 Mingw-64,pip 在包的下游被修补。要安装软件包,请运行:pacman -S mingw-w64-x86_64-python-pip然后,您应该能够使用 python -m pip 安装 jupyter 和其他软件包。 ,但避免运行 python -m pip --upgrade pip因为这会覆盖打包的版本。
我还建议通过运行 python -m venv .venv 来使用 virtualenv和 source .venv/bin/activate保持 pip 安装的软件包完全独立。

关于python - 在 MINGW64 上 pip 赞?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56930492/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com