pip install返回无效语法 [英] pip install returning invalid syntax
问题描述
我刚刚安装了pip随附的python 3.6
I've just installed python 3.6 which comes with pip
但是,在Windows命令提示符下,当我执行"pip install bs4"时,它会在安装字下返回"SyntaxError:无效语法".
However, in Windows command prompt, when I do: 'pip install bs4' it returns 'SyntaxError: invalid syntax' under the install word.
键入"python"将返回版本,这表示已正确安装.可能是什么问题?
Typing 'python' returns the version, which means it is installed correctly. What could be the problem?
推荐答案
尝试一下.
python -m pip ...
-m module-name在sys.path中搜索指定的模块,并将相应的.py文件作为脚本运行.
-m module-name Searches sys.path for the named module and runs the corresponding .py file as a script.
有时候操作系统找不到pip,所以python
或py
-m
可能解决了这个问题,因为它是python本身在搜索pip
.
Sometimes the OS can't find pip so python
or py
-m
may solve the problem because it is python itself searching for pip
.
这篇关于pip install返回无效语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!