问题描述
这是我在 Cygwin 中得到的:
$ where python
C:\cygwin64\bin\python
C:\Users\eeng1\AppData\Local\Programs\Python\python39\python.exe
C:\Users\eeng1\AppData\Local\Microsoft\WindowsApps\python.exe
$ which python
/usr/bin/python
我想知道这两件事:
- 为什么 cygwin 在我没有安装 Python 时已经包含它?路径在 where 和 which 命令结果之间似乎不匹配。
- 有没有办法删除 cygwin bin 文件夹中的 Python?
- 为什么WindowsApps文件夹下有一个python?我不记得实际上在那里放了什么 Python。
4.我如何告诉 Cygwin 它必须运行在 python39 文件夹中找到的 python.exe 而不是任何其他文件夹!
编辑:
当我尝试使用推荐给我的 Cygwin 安装程序卸载 Python 时。我明白了:
问题 1/1 包 clang-8.0.1-1 需要 python2,但没有 可以安装提供程序解决方案 1/2
看来我不能只是摆脱cygwin bin文件夹中存在的Python2。没有直接的方法可以做到这一点。
解决方法
在 Cygwin /usr/bin/python
下是一个由 alternatives
管理的链接
$ alternatives --display python
python - status is auto.
link currently points to /usr/bin/python3.8
/usr/bin/python2.7 - priority 27
/usr/bin/python3.8 - priority 38
/usr/bin/python3.6 - priority 36
/usr/bin/python3.7 - priority 37
Current `best' version is /usr/bin/python3.8.
如果您想绕过 Cygwin python 并运行 Windows 版本(冒着破坏其他 Cygwin 程序的所有风险),您有多种选择:
- 设置指向 Windows 的替代项
- 将
C:\Users\eeng1\AppData\Local\Programs\Python\Python39\
放在 PATH 的/usr/bin/
之前 - 为完整的 windows python 使用别名。
关于删除python2,可以使用cygcheck-dep
包来识别依赖。在我的系统上:
$ cygcheck-dep -q -n python2
python2: is needed for ( clang clang-analyzer gobject-introspection libfontforge2 libglib2.0-devel libgtk2.0-devel libpeas1.0_0 llvm nghttp2 octave-miscellaneous pulseaudio-equalizer python python-gobject-devel python2-backports.ssl_match_hostname python2-gobject python2-pyqt5 python2-sip )
所以要删除 python2
,我还应该删除所有不需要的包。
与cygcheck-dep -q -N python2
你还会看到所有需要递归的包 python2)