Windows 上的 pip 给出错误 - 未知或不受支持的命令“安装”;

发布于 2024-12-05 13:09:32 字数 471 浏览 1 评论 0原文

我通过下载 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

情痴 2024-12-12 13:09:32

你碰巧在某个地方有 Perl pip 吗?

听起来像这里描述的问题:

https://github.com/mike-perdide/gitbuster/ issues/62

要进行检查,请在 Windows 命令提示符下执行:

C:\>where pip

这可能会输出以下内容:

C:\strawberry\perl\bin\pip
C:\strawberry\perl\bin\pip.bat

如果是这样,这就是您的问题。卸载 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:

C:\>where pip

This will potentially output the following:

C:\strawberry\perl\bin\pip
C:\strawberry\perl\bin\pip.bat

If so, this is your problem. Unistall Strawberry Perl or use the full path to python pip.

物价感观 2024-12-12 13:09:32

这个错误是因为系统在找到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.

拥抱没勇气 2024-12-12 13:09:32

我也遇到了这个问题,就像 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>

弃爱 2024-12-12 13:09:32

在 Ubuntu 下也遇到同样的问题,结果是:

$ sudo apt-get remove pip
$ sudo apt-get install python-pip

Had the same problem under Ubuntu and did:

$ sudo apt-get remove pip
$ sudo apt-get install python-pip
徒留西风 2024-12-12 13:09:32

环境变量中为pip.exe文件提供路径,

您应该在执行安装命令

pip.exe install selenium 

您应该使用下面的命令这对我来说肯定有效工作了:)

You should provide path in environment variable for pip.exe file

while executing install command you should use below command

pip.exe install selenium 

This will surely work, for me this worked :)

病毒体 2024-12-12 13:09:32

除了约翰内斯非常有用的回答之外:
如果您不想卸载 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 your Python\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".

笑,眼淚并存 2024-12-12 13:09:32

您也可以在不删除 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.

若能看破又如何 2024-12-12 13:09:32

对于 Python 3.X 及更高版本:

在 CMD 提示符中键入:

py -m pip install  <package_name>

确保 pip 已安装。
设置 pip 的环境变量指向 exe 文件

升级:

py -m pip install --upgrade pip

For Python 3.X and above:

In the CMD prompt type:

py -m pip install  <package_name>

Make sure pip is installed already.
Setup the environment variable for pip pointing to the exe file

To upgrade:

py -m pip install --upgrade pip
隔纱相望 2024-12-12 13:09:32

DwimPerl 也有同样的问题。卸载 Dwim 也解决了这个问题。

Same issue with DwimPerl. Uninstalling Dwim fixed the issue as well.

绝影如岚 2024-12-12 13:09:32

C:\Python27\Scripts\pip.exe install -U selenium

C:\Python27\Scripts\pip.exe install -U selenium

暗喜 2024-12-12 13:09:32

我在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.

江南烟雨〆相思醉 2024-12-12 13:09:32

打开 cmd 并输入 pip 和您将拥有的位置

C:\Dwimperl\perl\bin\pip.bat
C:\Dwimperl\perl\bin
C:\Users\athus\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe

,然后转到 C:\Dwimperl\perl 并删除 bin 文件夹。
再次输入 where pip,您将只拥有

C:\Users\athus\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe

并享受 python pip。

open cmd and type where pip and you will have

C:\Dwimperl\perl\bin\pip.bat
C:\Dwimperl\perl\bin
C:\Users\athus\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe

and go to C:\Dwimperl\perl and delete bin folder.
and again type where pip and you will only have

C:\Users\athus\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe

and enjoy python pip.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文