有人可以帮我解决这个问题吗?我正在尝试在 Windows 上安装 Pip 以与 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)]
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")
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
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\
对环境变量下的路径进行了相应的更改,现在这些命令起作用了:
>C:\PyPy\pypy3.10-v7.3.15-win64\pypy3.exe -m ensurepip
...
>pypy3 -m pip install tqdm
感谢mattip的建议!
您是否尝试将
C:\Program Files (x86)\PyPy\pypy3.10-v7.3.15-win64\bin
添加到 PATH 中?因为你的命令 pip 应该安装到 bin
的路径。