python pip install在Windows上不起作用 [英] python pip install not working on windows

查看:234
本文介绍了python pip install在Windows上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上安装了python 2.7.10,并且尝试使用以下命令在命令行上安装Django:

I have python 2.7.10 installed on windows and I am trying to install Django on the commandline with the following command:

C:/users/user/myproject> python pip install django

这将显示以下错误:

python: can't open file 'pip' [Errno 2] No such file or directory

Python已安装在C:\Python27中,并且PATH环境变量也已设置为该变量.

Python is installed in C:\Python27 and the PATH environment variable is also set to that.

为什么点子不起作用?

推荐答案

因为Python 2.7.9 pip

Since Python 2.7.9 pip is included when python is installed.

但是python安装的scripts子文件夹可能未添加到PATH环境变量中,因此仅通过键入pip install就无法访问.但是,只要您的python可执行文件在路径上,,您就可以使用标志以将pip模块作为脚本执行:

However the scripts subfolder of your python installation might not be added to your PATH environment variable, and hence inaccessible by just typing pip install. However as long as your python executable is on the path, you can use the python -m flag to execute the pip module as a script:

python -m pip install SomePackage

只要PATH位于PATH上,它就可以从命令行运行.

This should work from the command line as long as python is on PATH.

如果您想直接从cmd.exe提示符下使用pip,则需要将scripts目录添加到您的PATH环境变量中:

If you would like to use pip directly from the cmd.exe prompt you need to add the scripts directory to your PATH environment variable:

SET PATH=%PATH%;C:\Python27\scripts

这篇关于python pip install在Windows上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆