繁体   English   中英

CMD 无法识别 python 模块为内部或外部命令、可运行程序或批处理文件

[英]CMD is not recognized python modules as an internal or external command, operable program or batch file

当我尝试使用pip install安装任何模块时,cmd/vscode 返回此消息(我尝试使用不同的模块)

C:\>pip install solc-select
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
Requirement already satisfied: solc-select in c:\python310\lib\site-packages (0.2.1)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: There was an error checking the latest version of pip.

但是当我尝试运行模块的代码时,我遇到了这个问题:

C:\>solc-select use 0.8.7
'solc-select' is not recognized as an internal or external command,
operable program or batch file.

我也重新安装了我的 Python 3 和 pip。

Python 3.10.5
C:\>pip --version
pip 22.1 from C:\Users\Jester\AppData\Roaming\Python\Python310\site-packages\pip (python 3.10)

我在 Windows 10 x64 上遇到了这个问题,我已将 Python 和 pip 文件夹/文件添加到我的系统变量中。

用虚拟环境试试。 为此,请执行以下步骤:

  • 在 VScode(或单独的命令屏幕)中,确保您位于工作文件夹中。
  • 使用命令python -m venv venv初始化一个虚拟环境。 这将在您的工作文件夹中创建一个文件夹“venv”
  • 使用bin\venv\activate激活您的虚拟环境,您现在应该在命令提示符中看到(venv) - C:/path/to/working/folder
  • 安装你想要的模块,使用你的虚拟环境和pip install sold-select

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM