问题描述
我正在尝试使用 pip 安装软件包.我尝试从 Python shell 运行 pip install,但得到一个 SyntaxError.为什么我会收到此错误?如何使用 pip 安装包?
I'm trying to use pip to install a package. I try to run pip install from the Python shell, but I get a SyntaxError. Why do I get this error? How do I use pip to install the package?
>>> pip install selenium
^
SyntaxError: invalid syntax
推荐答案
pip 是从命令行运行的,而不是 Python 解释器.它是一个安装模块的程序,因此您可以从 Python 中使用它们.安装模块后,您可以打开 Python shell 并执行 import selenium.
pip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do import selenium.
Python shell 不是命令行,它是一个交互式解释器.您在其中输入 Python 代码,而不是命令.
The Python shell is not a command line, it is an interactive interpreter. You type Python code into it, not commands.
这篇关于为什么“pip install"?在 Python 内部引发 SyntaxError?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)