简体   繁体   English

“Pip”在命令提示符中被识别,但在 PyCharm 终端中不被识别

[英]'Pip' recognized in Command Prompt but not in PyCharm terminal

When I try to run pip in the Windows Command Prompt, pip -V works fine, but when I try to run it in PyCharm terminal I get 'pip' is not recognized as an internal or external command, operable program or batch file.当我尝试在 Windows 命令提示符中运行 pip 时, pip -V工作正常,但是当我尝试在 PyCharm 终端中运行它时,我得到'pip' is not recognized as an internal or external command, operable program or batch file.

My Path environmental variables are set for:我的路径环境变量设置为:

C:\Users\username\AppData\Local\Programs\Python\Python37\Scripts\
C:\Users\username\AppData\Local\Programs\Python\Python37\
C:\Users\username\AppData\Roaming\Python\Python37\Scripts\
C:\Users\username\AppData\Roaming\Python\Python37\

The main difference I can think of is that the PyCharm terminal and project opens on D: , and my path variables are set to C: but I don't know why that would affect it.我能想到的主要区别是 PyCharm 终端和项目在D:上打开,我的路径变量设置为C:但我不知道为什么会影响它。 I have recently uninstalled and reinstalled both PyCharm and Python (a previous version) if that helps, but I made it a point to not import any settings.如果有帮助,我最近卸载并重新安装了 PyCharm 和 Python(以前的版本),但我强调不导入任何设置。

This is a potential duplicate of this question but it's also unresolved.这是这个问题的潜在重复,但也未解决。

Answer to my own question: when things don't make sense, try turning it off and on again. 回答我自己的问题:当事情没有意义时,请尝试将其关闭再打开。 Problem was fixed with a restart. 问题已通过重启修复。

Check your Preferences -> Project -> Python Interpreter settings: 检查首选项 - >项目 - > Python解释器设置:

项目口译员设置

(sorry for Mac screenshots and paths, but not near my Windows PC atm but should give general idea of a possible problem area and how to correct) (对不起Mac的截图和路径,但不在我的Windows PC附近,但应该对可能的问题区域以及如何纠正提供一般概念)

Hi I have a similar problem.嗨,我有类似的问题。 It works when I look up a package in the interpreter in settings but not when I run the command in the terminal.当我在设置中的解释器中查找包时它起作用,但当我在终端中运行命令时不起作用。 Some libraries won't even install via this route.有些库甚至不会通过这条路线安装。 Anyone knows what is going on?有谁知道发生了什么?

I included a screenshot of my error message I received when trying to install pandas library.我包含了我在尝试安装 pandas 库时收到的错误消息的屏幕截图。 Error message错误信息

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

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