Windows 上的 pip 给出错误 - 未知或不受支持的命令“安装”;
我通过下载 http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49并运行 python setup.py install
安装顺利,没有错误。
但是当我尝试用它安装 selenium 包时,它给了我以下错误 -
pip install -U selenium
Unknown option: u
Unknown or unsupported command 'install'
我在哪里犯了错误?
I installed pip on Windows by downloading http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49 and running python setup.py install
Installation went fine with no errors.
But when I tried installing selenium package with it, it gives me the following error -
pip install -U selenium
Unknown option: u
Unknown or unsupported command 'install'
Where I'm making the mistake?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
你碰巧在某个地方有 Perl pip 吗?
听起来像这里描述的问题:
https://github.com/mike-perdide/gitbuster/ issues/62
要进行检查,请在 Windows 命令提示符下执行:
这可能会输出以下内容:
如果是这样,这就是您的问题。卸载 Strawberry Perl 或使用 python pip 的完整路径。
Do you happen to have the Perl pip lying around somewhere?
Sounds like the problem described here:
https://github.com/mike-perdide/gitbuster/issues/62
To check, in Windows command prompt execute:
This will potentially output the following:
If so, this is your problem. Unistall Strawberry Perl or use the full path to python pip.
这个错误是因为系统在找到pip.exe之前先找到pip.bat。
您不需要卸载 Strawberry Perl 或输入整个路径。
当我想使用 Python 实用程序时,我所做的就是简单地键入 pip.exe(与 apt-get 相同的击键次数)。在安装了 Python(x,y) 2.7x 和 Strawberry Perl 的 Win7 上,此方法似乎对我有用。
This error is because the system is finding pip.bat before it finds pip.exe.
You do NOT need to uninstall Strawberry Perl or type the whole path.
What I do is to simply type pip.exe (same number of keystrokes as apt-get) when I want to use the Python utility. This method seems to work find for me on Win7 with Python(x,y) 2.7x and Strawberry Perl installed.
我也遇到了这个问题,就像 Johannes 所说,这是因为 perl pip 干扰了你的 Python pip。
要解决这个问题,您也可以简单地执行以下操作:
python -m pip install
I had this problem as well, and like Johannes said, it's because the perl pip is interfering with your Python pip.
To get around it, you can simply do this as well:
python -m pip install <package_name>
在 Ubuntu 下也遇到同样的问题,结果是:
Had the same problem under Ubuntu and did:
在
环境变量
中为pip.exe
文件提供路径,您应该在执行
安装命令
时您应该使用下面的命令这对我来说肯定有效工作了:)
You should provide path in
environment variable
forpip.exe
filewhile executing
install command
you should use below commandThis will surely work, for me this worked :)
除了约翰内斯非常有用的回答之外:
如果您不想卸载 Strawberry,可以重新排列 Windows 系统中
PATH
条目的顺序,以确保在 Strawberry 条目之前找到您的Python\Scripts
。如果您不想手动执行此操作,可以使用“快速环境编辑器”等工具。In addition to the very helpful nswer of Johannes:
If you don't want to uninstalll Strawberry, you can re-arrange the order of
PATH
entrys in your Windows system to ensure yourPython\Scripts
are found before the strawberry entries. If you don't want to do this manually, you can use tools like the "Rapid Environment Editor".您也可以在不删除 Strawberry Perl 或键入整个路径的情况下解决此问题。移动到此 C:\Python2.7\Scripts(您的 Python 目录)目录,然后使用 pip 命令。
You can also solve this problem without removing Strawberry Perl or type the whole path.Move to this C:\Python2.7\Scripts(your Python directory) directory,then use pip command.
对于 Python 3.X 及更高版本:
在 CMD 提示符中键入:
确保 pip 已安装。
设置 pip 的环境变量指向 exe 文件
升级:
For Python 3.X and above:
In the CMD prompt type:
Make sure pip is installed already.
Setup the environment variable for pip pointing to the exe file
To upgrade:
DwimPerl 也有同样的问题。卸载 Dwim 也解决了这个问题。
Same issue with DwimPerl. Uninstalling Dwim fixed the issue as well.
C:\Python27\Scripts\pip.exe install -U selenium
C:\Python27\Scripts\pip.exe install -U selenium
我在windows 10中也遇到了同样的问题,最终成功解决了问题。
我使用了以下命令
where pip
我展示了 pip 的多个安装。一旦删除其他安装,它就可以正常工作。
I have the same problem in windows 10, finally resolved the problem successfully.
I used the following command
where pip
I was showing multiple installations of pip. Once removed other installation it worked fine.
打开 cmd 并输入 pip 和您将拥有的位置
,然后转到 C:\Dwimperl\perl 并删除
bin
文件夹。再次输入 where pip,您将只拥有
并享受 python pip。
open cmd and type where pip and you will have
and go to
C:\Dwimperl\perl
and deletebin
folder.and again type where pip and you will only have
and enjoy python pip.