“ pip”可以从powershell cli正常工作。当虚拟环境启动时,我得到Fatal error in launcher: Unable to create process using '"c:\py\venvs\x1\scripts\python.exe" "C:\py\venvs\x1\Scripts\pip.exe"'
有类似问题的各种报道。我已经在虚拟环境中重新安装了pip,并且同时使用了python -m venv
和virtualenv。以下是使用-m venv
时遇到的错误。
我的问题是如何使它工作,以便pip可以在虚拟环境中运行和安装软件包?
部分问题是区分大小写,此处未显示,我尝试创建指向“脚本”的“脚本”的符号链接,这样做时,我收到“没有名为pip的模块”消息。
在最后一行中,当它失败时,诊断程序正在谈论系统级(我的appdata文件夹)中的点而不是虚拟环境。
我的家用计算机上的3.6.6和3.8.1都会发生这种情况。在我的工作机上不会发生。
PS C:\> C:\users\pa2\appdata\Local\Programs\Python\Python36\python.exe -m venv /py/venvs/x1
PS C:\> C:\py\venvs\x1\Scripts\Activate.ps1
(x1) PS C:\> pip
Fatal error in launcher: Unable to create process using '"c:\py\venvs\x1\scripts\python.exe" "C:\py\venvs\x1\Scripts\pip.exe" '
(x1) PS C:\> cd C:\py\venvs\x1\Scripts\
(x1) PS C:\py\venvs\x1\Scripts> python -m pip install rope
C:\py\venvs\x1\Scripts\python.exe: No module named pip
(x1) PS C:\py\venvs\x1\Scripts> curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
(x1) PS C:\py\venvs\x1\Scripts> python get-pip.py
Collecting pip
Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
Collecting setuptools
Using cached setuptools-45.2.0-py3-none-any.whl (584 kB)
Collecting wheel
Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip setuptools wheel
(x1) PS C:\py\venvs\x1\Scripts> ls -l pip.exe
Directory: C:\py\venvs\x1\Scripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/9/2020 7:02 PM 106344 pip.exe
(x1) PS C:\py\venvs\x1\Scripts> date
Sunday, February 9, 2020 7:02:25 PM
(x1) PS C:\py\venvs\x1\Scripts> python -m pip
C:\py\venvs\x1\Scripts\python.exe: No module named pip
(x1) PS C:\py\venvs\x1\Scripts> pip
Fatal error in launcher: Unable to create process using '"c:\py\venvs\x1\scripts\python.exe" "C:\py\venvs\x1\Scripts\pip.exe" ': The system cannot find the file specified.
(x1) PS C:\py\venvs\x1\Scripts> cat env:path
C:\py\venvs\x1\Scripts;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\RSA SecurID Token Common;C:\Program Files\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Gow\bin;C:\opt\spark\spark-2.4.0-bin-hadoop2.7\bin;c:\bin;C:\Program Files\Amazon\AWSCLI\bin\;C:\Users\pa2\AppData\Local\Microsoft\WindowsApps;
(x1) PS C:\py\venvs\x1\Scripts> .\python.exe .\pip.exe install rope
Traceback (most recent call last):
File "C:\users\pa2\appdata\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\users\pa2\appdata\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File ".\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
尝试