windows下python pip 路径的pip install 安装路径在哪

为Windows安装python的easy install和pip
为了使用python种类繁多的library,必须先安装setuptools和pip这一类的安装工具
直接下载setuptools的可执行文件,在Windows下即使设置了python的路径默认setuptools也是找不到python的。
解决方法:运行下面的脚本,将自动根据当前的python版本安装合适的setuptools。
这个脚本可以在/dist/ez_setup.py找到
&&&Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
import sys
DEFAULT_VERSION = &0.6c11&
DEFAULT_URL
= &http://pypi.python.org/packages/%s/s/setuptools/& % sys.version[:3]
md5_data = {
'setuptools-0.6b1-py2.3.egg': '8822cafb996b7f25c6e6ca',
'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
'setuptools-0.6b2-py2.3.egg': 'a6d8fc72d99b',
'setuptools-0.6b2-py2.4.egg': 'd2be661fa32a6e52e4f82a',
'setuptools-0.6b3-py2.3.egg': 'bb31c0fc5cad9f5a0618',
'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecdda669fac',
'setuptools-0.6b4-py2.3.egg': 'e1ebc77fe039aa4e6f7e5',
'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
'setuptools-0.6c1-py2.3.egg': 'b3f2bf74adc',
'setuptools-0.6c1-py2.4.egg': 'b45adedaffea4b',
'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3afc',
'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9ba',
'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97ce8596aeb8c7',
'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ceb7f5',
'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4cdec2ec0c2b',
'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
'setuptools-0.6c11-py2.6.egg': 'bfa9a213eedd356d64086',
'setuptools-0.6c2-py2.3.egg': 'fb7d0f3ba0b43f20817c27',
'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
'setuptools-0.6c3-py2.4.egg': 'e0edbfb73bf803a50e7b71e',
'setuptools-0.6c3-py2.5.egg': 'abef16fddc7c6bd98965e',
'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
'setuptools-0.6c5-py2.3.egg': 'ee9fd8f3e6b7',
'setuptools-0.6c5-py2.4.egg': 'afe2adf1c0f5bcd8aa64',
'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
'setuptools-0.6c6-py2.3.egg': 'ad549ec20',
'setuptools-0.6c6-py2.4.egg': '3c56af57beaab',
'setuptools-0.6c6-py2.5.egg': 'b2f8ab34f8f53',
'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615ee13e2',
'setuptools-0.6c7-py2.4.egg': '5a8fa0fb67cf1f26c55a82e',
'setuptools-0.6c7-py2.5.egg': '45d2ad28ffde831e8372',
'setuptools-0.6c8-py2.3.egg': 'db8cfd807ba',
'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
'setuptools-0.6c8-py2.5.egg': '9dcb3e1ac95b',
'setuptools-0.6c9-py2.3.egg': 'a83cb496e4cfbe08507c03',
'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e45a',
import sys, os
try: from hashlib import md5
except ImportError: from md5 import md5
def _validate_md5(egg_name, data):
if egg_name in md5_data:
digest = md5(data).hexdigest()
if digest != md5_data[egg_name]:
print &&sys.stderr, (
&md5 validation of %s failed!
(Possible download problem?)&
% egg_name
sys.exit(2)
return data
def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
&&&Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end with
`to_dir` is the directory where setuptools will be downloaded, if
it is not already available.
If `download_delay` is specified, it should
be the number of seconds that will be paused before initiating a download,
should one be required.
If an older version of setuptools is installed,
this routine will print a message to ``sys.stderr`` and raise SystemExit in
an attempt to abort the calling script.
was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
def do_download():
egg = download_setuptools(version, download_base, to_dir, download_delay)
sys.path.insert(0, egg)
setuptools.bootstrap_install_from = egg
import pkg_resources
except ImportError:
return do_download()
pkg_resources.require(&setuptools&=&+version); return
except pkg_resources.VersionConflict, e:
if was_imported:
print &&sys.stderr, (
&The required version of setuptools (&=%s) is not available, and\n&
&can't be installed while this script is running. Please install\n&
& a more recent version first, using 'easy_install -U setuptools'.&
&\n\n(Currently using %r)&
) % (version, e.args[0])
sys.exit(2)
except pkg_resources.DistributionNotFound:
del pkg_resources, sys.modules['pkg_resources']
# reload ok
return do_download()
def download_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
delay = 15
&&&Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download attempt.
import urllib2, shutil
egg_name = &setuptools-%s-py%s.egg& % (version,sys.version[:3])
url = download_base + egg_name
saveto = os.path.join(to_dir, egg_name)
src = dst = None
if not os.path.exists(saveto):
# Avoid repeated downloads
from distutils import log
log.warn(&&&
---------------------------------------------------------------------------
This script requires setuptools version %s to run (even to display
I will attempt to download it for you (from
you may need to enable firewall access for this script first.
I will start the download in %d seconds.
(Note: if this machine does not have network access, please obtain the file
and place it in this directory before rerunning this script.)
---------------------------------------------------------------------------&&&,
version, download_base, delay, url
); fr sleep(delay)
log.warn(&Downloading %s&, url)
src = urllib2.urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = _validate_md5(egg_name, src.read())
dst = open(saveto,&wb&); dst.write(data)
if src: src.close()
if dst: dst.close()
return os.path.realpath(saveto)
def main(argv, version=DEFAULT_VERSION):
&&&Install or upgrade setuptools and EasyInstall&&&
import setuptools
except ImportError:
egg = None
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
mand.easy_install import main
return main(list(argv)+[egg])
# we're done here
if egg and os.path.exists(egg):
os.unlink(egg)
if setuptools.__version__ == '0.0.1':
print &&sys.stderr, (
&You have an obsolete version of setuptools installed.
&remove it from your system entirely before rerunning this script.&
sys.exit(2)
req = &setuptools&=&+version
import pkg_resources
pkg_resources.require(req)
except pkg_resources.VersionConflict:
mand.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
mand.easy_install import main
main(argv)
print &Setuptools version&,version,&or greater has been installed.&
print '(Run &ez_setup.py -U setuptools& to reinstall or upgrade.)'
def update_md5(filenames):
&&&Update our built-in md5 registry&&&
for name in filenames:
base = os.path.basename(name)
f = open(name,'rb')
md5_data[base] = md5(f.read()).hexdigest()
%r: %r,\n& % it for it in md5_data.items()]
data.sort()
repl = &&.join(data)
import inspect
srcfile = inspect.getsourcefile(sys.modules[__name__])
f = open(srcfile, 'rb'); src = f.read(); f.close()
match = re.search(&\nmd5_data = {\n([^}]+)}&, src)
if not match:
print &&sys.stderr, &Internal error!&
sys.exit(2)
src = src[:match.start(1)] + repl + src[match.end(1):]
f = open(srcfile,'w')
f.write(src)
if __name__=='__main__':
if len(sys.argv)&2 and sys.argv[1]=='--md5update':
update_md5(sys.argv[2:])
main(sys.argv[1:])
接下来就可以按照pip了,下载pip-1.2.1.tar.gz并解压,使用python setup.py install命令即可安装
这时打开python根目录下的Scripts文件夹可以发现多出了以下内容
将python/Scripts也添加到Path中,至此pip已经可以使用
看过本文的人也看了:
我要留言技术领域:
取消收藏确定要取消收藏吗?
删除图谱提示你保存在该图谱下的知识内容也会被删除,建议你先将内容移到其他图谱中。你确定要删除知识图谱及其内容吗?
删除节点提示无法删除该知识节点,因该节点下仍保存有相关知识内容!
删除节点提示你确定要删除该知识节点吗?windows-python开发环境下各种依赖包的安装 - NoBug,Perfect - CSDN博客
windows-python开发环境下各种依赖包的安装
本文主要是为了记录python开发时遇到的no module named
**问题。例如:
no module named numpy
no module named matplotlib
python官网:
Python安装过程可参考:
1.设置环境变量
  方便从cmd命令行中查看,需要将当前python安装路径添加到环境变量Path中去:
电脑-&属性-&高级系统设置-&环境变量-&系统变量-&Path-&编辑-&新建
然后python安装路径粘贴进去,一路确定就OK。
2.安装pip
  python中依赖包的安装方式可以选择whl文件安装,也可以选择下载压缩包利用setup.py安装,也可以用pip install XXXX安装,但是不管那种方式都需要pip命令
因此需要安装pip,官方下载地址:
下载完成之后,解压到一个文件夹,用CMD控制台进入解压目录,输入:
python setup.py install
  安装完后,仍然需要添加环境变量才能在cmd命令中调用。注意这里是将安装路径下的scrips路径加入环境变量,例如我的安装路径是C:\Python27,因此需要将C:\Python27\Scripts加入Path环境变量。
然后 pip list就可以查看所有安装的包。
3.使用pip方式安装依赖包(推荐)
  这种方式最省心,系统会自动更新升级需要的版本。例如安装matplotlib包的时候,在cmd命令行中,随便目录下即可运行:
pip install matplotlib
4.使用whl方式安装
   [这里whl大全:当然也可以从官网搜索咯]
1.下载whl包
2.pip install wheel
3.pip install ****.whl
5.使用python setup.py install方式安装
  下载地址:,搜索下载即可。
找到后,点击,列表最后有个type为source的tar.gz的文件,下载完后,去掉后缀的md5码,然后解压该压缩文件,放到自己认为合适的文件夹下。然后在cmd中切换到该目录下:
例如:D:\pythonPlugFile\setuptools-36.0.1
确定有setup.py文件后,运行:
python setup.py install
我的热门文章Mac 上 pip 安装的可执行程序在哪个目录呢? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
已注册用户请 &
推荐学习书目
Python Sites
值得关注的项目
Python 编程
Mac 上 pip 安装的可执行程序在哪个目录呢?
10:26:28 +08:00 · 8002 次点击
brew install python3
pip 8.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
pip install speedtest-cli
setuptools (21.2.2)
speedtest-cli (0.3.4)
wheel (0.26.0)
speedtest-cli
zsh: command not found: speedtest-cli
echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
很是操蛋,应该怎么修复 PATH 呢?
11 回复 &| &直到
17:49:34 +08:00
& & 10:37:47 +08:00 via iPhone
Python3 对应 pip3
& & 10:43:21 +08:00
~ pip -V
pip 8.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
?
~ python3 -m pip -V
pip 8.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
& & 11:00:56 +08:00 via Android
所以我现在都是放虚拟机里面了…
& & 11:16:07 +08:00
which pip 不行吗
& & 11:21:04 +08:00
感觉你的环境跟我的不一样呢?
不过默认都是在 `/usr/local/bin` 目录下创建有链接的.
Python 2 及 pip 是系统自带的. Python 3 是我用 brew install 安装 的. 这里没有 pip3 ,而是更具体的
```console
?
~ which pip
/usr/local/bin/pip
?
~ which pip3
pip3 not found
?
~ which pip3.5
/usr/local/bin/pip3.5
?
~ which python
/usr/bin/python
?
~ which python3
/usr/local/bin/python3
?
~ ls -l $(which python3)
lrwxr-xr-x
6 30 10:03 /usr/local/bin/python3 -& ../Cellar/python3/3.5.2/bin/python3
?
~ ls -l $(which pip3.5)
lrwxr-xr-x
6 30 10:03 /usr/local/bin/pip3.5 -& ../Cellar/python3/3.5.2/bin/pip3.5
?
~ ls -l $(which pip)
-rwxr-xr-x
9 22:49 /usr/local/bin/pip
?
~ ls -l $(which python)
-rwxr-xr-x
6 16:37 /usr/bin/python
?
& & 11:23:21 +08:00
& & 12:38:30 +08:00
~ ls -l $(which pip)
-rwxr-xr-x
5 30 11:11 /usr/local/bin/pip
?
~ ls -l $(which python3)
lrwxr-xr-x
7 23 09:42 /usr/local/bin/python3 -& ../Cellar/python3/3.5.2/bin/python3
/usr/local/bin 这个目录里面没有那些通过 pip 安装的程序
& & 13:36:06 +08:00 via iPhone
/use/local/lib/python3.5/site-packages
在这个目录下,建个软链到 /usr/local/bin/下面吧
& & 14:00:08 +08:00
& & 14:23:00 +08:00
楼主不会在装 Pokemon 的地图吧
& & 17:49:34 +08:00
我用 port 安装的 python3 居然是在这个目录:
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/
& · & 515 人在线 & 最高记录 3541 & · &
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.0 · 57ms · UTC 20:41 · PVG 04:41 · LAX 13:41 · JFK 16:41? Do have faith in what you're doing.windows下python pip等安装 - CSDN博客
windows下python pip等安装
本文参考了http://blog.chinaunix.net/uid--id-3859827.html
这两天在研究crawler,所以研究了Python。
在Python里面,pip是非常方便的包安装和管理工具,Python下面的许多库可以通过pip来安装。
pip的官方主页为https://pypi.python.org/pypi/pip,这里头简单介绍了pip的使用和开发等。
事实上除了pip,还有easy_install(以及disuti,setuptoolsl), 在网上百度到的资料看,pip是easy_install 的改进版,但是目前还是有些软件需要easy_install来安装。
(参考http://my.oschina.net/swrite/blog/298051)
pip的安装:
从下载了get-pip.py,然后在又管理员权限的终端中,输入
python get-pip.py,然后等待下,pip就装好了。
在安装完pip后,要更改环境变量,将Python安装目录下的Script子目录也添加到环境变量中去,由此安装结束。
easy_install,
可以从https://pypi.python.org/pypi/setuptools#windows-simplified进行下载ez_install.py脚本进行安装和下载。
easy_install 需要在powershell 中运行。
接下来就是使用了,简单的使用方法如下:
pip install Somepackage
pip install -U Somepackage 更新
pip uninstall Somepackage 卸载
pip search 搜寻
pip help帮助
pip show --files SomePage查看已经安装的软件
pip list --outdated列出需要更新的软件
pip list --outdate查看待更新软件
参考了/python/how-to-install-and-use-pip-ttlsa/
这里建议大家还是参考官方页面吧。就不赘述了。
本文已收录于以下专栏:
相关文章推荐
NumPy 是一个基础科学的计算包。很多的科学计算特别是向量处理的时候会用到。
因为用到了,而且安装的过程中出现了一些问题,所以记录下来,便于备查。
平台: windows 8.1 
Python: ...
easy_install 打包和发布 python 包
pip 是包管理
https://pypi.python.org/pypi/setuptools/1.0#windows
主要来说...
UnicodeDecodeError
错误信息:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0:...
下载安装Notepad++文本编辑器,可去http://notepad-plus-plus.org/下载。从开始菜单运行PowerShell程序。(win7及以上都有,一般我们用的cmd.exe可用性...
【原因分析】
     是因为anaconda的安装目录的拥有者和用户组都是root,本地用户权限不够,只需让自己拥有相应的权限就好了
【解决方案】
     输入一下命令,进入到anacond...
Windows下python安装easy_install和pip并安装requests和BeautifulSoup
当我们使用Python爬取网页内容的时候往往需要用到requests和Beaut...
Windows环境下安装pip和easy_install
先安装easy_install和setuptools
cd setuptools-18.7.1
python setup.py instal...
从名字就可以看出,FragmentStatePagerAdapter就是用Fragment作为ViewPager的view来显示
所以使用方法和ViewPager差不多,但也有区别
总体的思路是,...
简介  pip用于python包的安装,类似于Redhat下的yum、Ubuntu下的apt-get,可以解决安装包依赖的问题,非常方便。这里,我们主要讲下windows下的配置。
配置文件路径...
1.安装python 第一步,windows下面的Python安装一般是通过软件安装包安装而不是命令行,所以我们首先要在Python的官方主页上面下载最新的Python安装包。
 下载地址是:htt...
他的最新文章
讲师:宋宝华
讲师:何宇健
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)

我要回帖

更多关于 python pip install 的文章

 

随机推荐