已解决:Windows环境下PyPy安装Pip失败的问题及解决方法
Windows下PyPy安装Pip失败的解决过程
在Windows系统中尝试为PyPy安装Pip时遇到问题:执行pypy3 -m pip始终提示找不到pip模块,即使运行ensurepip或get-pip.py显示安装成功后依然无法正常使用。
尝试过的操作
- 查看PyPy版本:
C:\>pypy3 --version Python 3.10.13 (fc59e61cfbff, Jan 14 2024, 16:27:58) [PyPy 7.3.15 with MSC v.1929 64 bit (AMD64)]
- 尝试安装tqdm,提示缺少pip:
C:\>pypy3 -m pip install tqdm C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe: No module named pip (to install pip, you need to run once "C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe -m ensurepip")
- 运行
ensurepip安装pip:
C:\>"C:\Program Files (x86)"\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe -m ensurepip Defaulting to user installation because normal site-packages is not writeable Looking in links: c:\Users\karlv\AppData\Local\Temp\tmpgk258d80 Processing c:\users\karlv\appdata\local\temp\tmpgk258d80\setuptools-65.5.0-py3-none-any.whl Processing c:\users\karlv\appdata\local\temp\tmpgk258d80\pip-23.0.1-py3-none-any.whl Installing collected packages: setuptools, pip Successfully installed pip-24.0 setuptools-69.2.0
- 再次尝试安装tqdm,依然提示缺少pip:
C:\>pypy3 -m pip install tqdm C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe: No module named pip (to install pip, you need to run once "C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe -m ensurepip")
- 尝试使用
get-pip.py安装:
C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64>"C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe" "C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\get-pip.py" Defaulting to user installation because normal site-packages is not writeable Collecting pip Using cached pip-24.0-py3-none-any.whl.metadata (3.6 kB) Collecting setuptools Using cached setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB) Collecting wheel Using cached wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB) Using cached pip-24.0-py3-none-any.whl (2.1 MB) Using cached setuptools-69.2.0-py3-none-any.whl (821 kB) Using cached wheel-0.43.0-py3-none-any.whl (65 kB) Installing collected packages: wheel, setuptools, pip Successfully installed pip-23.0.1 setuptools-65.5.0 wheel-0.43.0
解决方法(更新)
将PyPy移动到无空格的目录后问题解决,新路径修改为:
C:\PyPy\pypy3.10-v7.3.15-win64\
同时更新环境变量中的Path,添加上述PyPy目录路径,之后以下命令可正常运行:
>C:\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe -m ensurepip ... >pypy3 -m pip install tqdm
感谢用户mattip的建议!
内容的提问来源于stack exchange,提问作者erling siemens
相关产品推荐
相关产品推荐

