-
pip安装
2019-01-17 20:12:441,查看是否安装pip pip --version 2,下载pip 打开下载地址:https://bootstrap.pypa.io/get-pip.py 下载文件get-pip.py,并保存到指定文件夹,我的是保存到C:\Python27文件夹下。 3,cmd中运行get-pip.py文件,...1,查看是否安装pip
pip --version2,下载pip
打开下载地址:https://bootstrap.pypa.io/get-pip.py
下载文件get-pip.py,并保存到指定文件夹,我的是保存到C:\Python27文件夹下。3,cmd中运行get-pip.py文件,就开始下载了
#cd C:\Python27#python get-pip.py
4,安装成功后,检查一下pip是否安装成功。
#pip -V
如果提示pip不是内部命令,说明pip命令不能使用。
先去C:\Python27\Scripts路径下看一下,如何和下图一样有pip相关文件说明安装成功了。可能是环境变量的路径问题。
解决办法:
把C:\Python27\Scripts路径添加到环境变量path中,如下图:
再检查一遍pip是否安装成功:
#pip -V
-
python 用pip安装cv2(超简单的一句话)
2019-04-24 18:45:20如果你已经装好了pip,那就直接 pip install opencv-python 就可以了 打个小广告~~如果你已经装好了pip,那就直接
pip install opencv-python
就可以了
-
Python 之 pip安装 及 使用详解
2018-12-14 13:59:34pip是啥 其实,pip就是 Python标准库(The Python Standard Library)中的一个包,这个包比较特殊,用它可以来管理Python标准库(The Python Standard Library)中其他的包。... 安装pip后,会向系统添加一...pip 是啥
pip 是 Python 的包安装程序。其实,pip 就是 Python 标准库(The Python Standard Library)中的一个包,只是这个包比较特殊,用它可以来管理 Python 标准库(The Python Standard Library)中其他的包。pip 支持从 PyPI,版本控制,本地项目以及直接从分发文件进行安装。pip 是一个命令行程序。 安装 pip 后,会向系统添加一个 pip 命令,该命令可以从命令提示符运行。
目前,pip 是 The Python Packaging Authority (PyPA) 推荐的 Python 包管理工具!英文比较好的同学可以直接去官网参看其用户手册PyPI(The Python Package Index,Python包索引)是 Python 编程语言的软件存储库。通常,我们就是从这上面安装各种 Python 的包,也可以在上面发布自己的包。
The Python Packaging Authority (PyPA) is a working group that maintains many of the relevant projects in Python packaging.安装
从 Python 2 版本 >=2.7.9 或 Python 3 版本 >=3.4 开始,官网的安装包中已经自带了 pip,在安装时用户可以直接选择安装。或者如果使用由
virtualenv
或者pyvenv
创建的 Virtual Environment,那么 pip 也是被默认安装的。
如果没有在安装的时候,选择上安装pip,那么也可以从本地安装。例如,直接使用get-pip.py
进行安装。首先从官网下载get-pip.py
,然后直接运行python get-pip.py
即可。更详细的安装,可以直接去官网参看安装说明
使用
安装后,在命令行中键入:
pip
+ 回车,就会出现如下使用说明:Usage: pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. help Show help for commands. General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort). --trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to alternate CA bundle. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output
pip命令组合比较灵活,下面重点介绍几个。
install
命令行直接键入
pip install
+ 回车,则 出现如下提示:ERROR: You must give at least one requirement to install (see "pip help install")
。接着我们键入pip help install
,就会出现pip install
的使用说明了,如下:Usage: pip install [options] <requirement specifier> [package-index-options] ... pip install [options] -r <requirements file> [package-index-options] ... pip install [options] [-e] <vcs project url> ... pip install [options] [-e] <local project path> ... pip install [options] <archive url/path> ... Description: Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. Install Options: -r, --requirement <file> Install from the given requirements file. This option can be used multiple times. -c, --constraint <file> Constrain versions using the given constraints file. This option can be used multiple times. --no-deps Don't install package dependencies. --pre Include pre-release and development versions. By default, pip only finds stable versions. -e, --editable <path/url> Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url. -t, --target <dir> Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions. --platform <platform> Only use wheels compatible with <platform>. Defaults to the platform of the running system. --python-version <python_version> Only use wheels compatible with Python interpreter version <version>. If not specified, then the current system interpreter minor version is used. A major version (e.g. '2') can be specified to match all minor revs of that major version. A minor version (e.g. '34') can also be specified. --implementation <implementation> Only use wheels compatible with Python implementation <implementation>, e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels. --abi <abi> Only use wheels compatible with Python abi <abi>, e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Generally you will need to specify --implementation, --platform, and --python-version when using this option. --user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.) --root <dir> Install everything relative to this alternate root directory. --prefix <dir> Installation prefix where lib, bin and other top-level folders are placed -b, --build <dir> Directory to unpack packages into and build in. Note that an initial build still takes place in a temporary directory. The location of temporary directories can be controlled by setting the TMPDIR environment variable (TEMP on Windows) appropriately. When passed, build directories are not cleaned in case of failures. --src <dir> Directory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src". -U, --upgrade Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used. --upgrade-strategy <upgrade_strategy> Determines how dependency upgrading should be handled [default: only-if-needed]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" - are upgraded only when they do not satisfy the requirements of the upgraded package(s). --force-reinstall Reinstall all packages even if they are already up-to-date. -I, --ignore-installed Ignore the installed packages (reinstalling instead). --ignore-requires-python Ignore the Requires-Python information. --no-build-isolation Disable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used. --install-option <options> Extra arguments to be supplied to the setup.py install command (use like --install-option="-- install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path. --global-option <options> Extra global options to be supplied to the setup.py call before the install command. --compile Compile Python source files to bytecode --no-compile Do not compile Python source files to bytecode --no-warn-script-location Do not warn when installing scripts outside PATH --no-warn-conflicts Do not warn about broken dependencies --no-binary <format_control> Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them. --only-binary <format_control> Do not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all source packages, :none: to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them. --prefer-binary Prefer older binary packages over newer source packages. --no-clean Don't clean up build directories. --require-hashes Require a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option. --progress-bar <progress_bar> Specify type of progress to be displayed [off|on|ascii|pretty|emoji] (default: on) Package Index Options: -i, --index-url <url> Base URL of Python Package Index (default https://pypi.org/simple). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format. --extra-index-url <url> Extra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url. --no-index Ignore package index (only looking at --find-links URLs instead). -f, --find-links <url> If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing. --process-dependency-links Enable the processing of dependency links. General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort). --trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to alternate CA bundle. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output
上面一大堆,总结来说,安装命令就是:
pip install <包名> 或 pip install -r requirements.txt
(对于本地安装包可以指定路径)。唯一需要特殊说明的是,安装时可以指定版本号来安装,举例如下:pip install SomePackage # 最新版本 pip install SomePackage==1.0.4 # 指定版本 pip install 'SomePackage>=1.0.4' # 最小版本
uninstall
卸载安装包命令:
pip uninstall <包名> 或 pip uninstall -r requirements.txt
升级包
pip install -U <包名> 或:pip install <包名> --upgrade
freeze
pip freeze 查看已经安装的包及版本信息。导出到指定文件中。例如,
pip freeze > requirements.txt
,文件名称随意;也可以使用pip install -r requirements.txt
,两者等效。list
列出当前已经安装的包。使用命令
pip list -o
则可查询可升级的包。
show
显示包所在目录及信息,格式为:
pip show <包名>
。如果不加包名,则提示ERROR: Please provide a package name or names.
。
search
搜索包,格式为:
pip search <搜索关键字>
。如果不写关键字,则提示ERROR: Missing required argument (search query).
。
参考
https://pip.pypa.io/en/stable/user_guide/
-
python中pip 安装、升级、升级固定的包
2018-06-19 17:31:471、pip下载安装 1.1 pip下载 进入https://pypi.python.org/pypi/pip,下载 .tar.gz压缩包 1.2Linux安装pip # tar -xzvf pip-1.5.4.tar.gz 解压 # cd pip-1.5.4 进入解压文件 # python setup.py install ...1、pip下载安装
1.1 pip下载
进入https://pypi.python.org/pypi/pip,下载 .tar.gz压缩包
1.2 Linux安装pip
# tar -xzvf pip-1.5.4.tar.gz 解压 # cd pip-1.5.4 进入解压文件 # python setup.py install 安装
1.3 升级pip
python -m pip install --upgrade pip
2. pip使用详解
2.1 pip安装包
# pip install 安装包名 [...] Successfully installed SomePackage #安装成功
2.2 pip查看是否已安装
# pip show --files 安装包名 Name:SomePackage # 包名 Version:1.0 # 版本号 Location:/my/env/lib/pythonx.x/site-packages # 安装位置 Files: # 包含文件等等 ../somepackage/__init__.py [...]
2.3 pip检查哪些包需要更新
# pip list --outdated
2.4 pip升级包
# pip install --upgrade 要升级的包名
包名 目前安装的版本号 最新版本号
2.5 pip卸载包
# pip uninstall 要卸载的包名
3. pip使用实例
3.1 安装redis
# pip install redis
3.2 卸载redis
# pip uninstall redis Uninstalling redis: /usr/lib/python3.6/site-packages/redis-2.9.1-py3.6.egg-info ......... Proceed (y/n)? y Successfully uninstalled redis # 卸载成功
4. pip参数解释
# pip --help Usage: pip<command>[options] Commands: install 安装包. uninstall 卸载包. freeze 按着一定格式输出已安装包列表 list 列出已安装包. show 显示包详细信息. search 搜索包,类似yum里的search. wheel Buildwheelsfromyourrequirements. zip 不推荐.Zipindividualpackages. unzip 不推荐.Unzipindividualpackages. bundle 不推荐.Createpybundles. help 当前帮助. GeneralOptions: -h,--help 显示帮助. -v,--verbose 更多的输出,最多可以使用3次 -V,--version 现实版本信息然后退出. -q,--quiet 最少的输出. --log-file<path> 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log --log<path> 不覆盖记录verbose输出的日志. --proxy<proxy> Specifyaproxyintheform[user:passwd@]proxy.server:port. --timeout<sec> 连接超时时间(默认15秒). --exists-action<action> Defaultactionwhenapathalreadyexists:(s)witch,(i)gnore,(w)ipe,(b)ackup. --cert<path> 证书.
-
python安装路径,pip安装的包以及pip的安装路径在哪?
2019-02-11 16:11:282.查看pip安装了多少包pip list 3.使用pip安装完包后,只需再执行一次命令pip install xx,就会显示安装路径。 如:pip install jupyter安装完成后,再次输入pip install jupyter就会显示此包已经安装的路径了。 ... -
python安装pip以及使用pip安装requests模块
2018-07-12 11:33:36要想使用pip安装模块就需要先安装pip 1:下载pip https://pypi.python.org/pypi/pip#downloads 2、下载完成之后,解压到一个文件夹,用CMD控制台进入解压目录,输入: python setup.py install 安... -
关于pip安装第三方库,但PyCharm中却无法识别的问题;以及PyCharm安装第三方库的方法解析
2018-11-11 16:36:47你有没有遇到过这样的怪事:“pip安装第三方库,但PyCharm中却无法识别的?”如果有,也许你需要看这篇文章,看完你就会知道pip按照的库在哪里;为什么安装后,PyCharm导入不了;以及PyCharm安装第三方库的方法解析... -
使用pip安装pymqsql,出现Cannot unpack file xxx的问题的解决以及pip安装速度慢或出现readtime out问题的...
2018-08-06 10:06:58最近作者在windows下使用pip安装pymysql的时候,出现Cannot unpack file xxx的问题。 问题出现的过程 我初步估计问题的主要原因是我在安装时,由于使用pip安装的时候,起初直接只用如下命令: pip install ... -
Python3.6安装 pip安装 BeautifulSoup安装
2017-02-25 23:53:31Python3.6安装 pip安装 BeautifulSoup安装Python安装只需要从官网上下载安装即可。 注意:安装开始前可以选择配置路径,这样就不用自己再配置了。pip安装pip安装通过下载源码的方式比较方便,通过cmd进入setup.py... -
pip安装faiss
2020-08-13 09:56:37由于在网上找到的总是conda安装的,但是我不习惯用conda,所以最后还是用pip安装了。 0.环境 ubuntu16.04 1.安装cpu版本faiss pip --default-time=1000 install -i ... -
解决pip安装超时的问题
2018-07-24 20:49:31使用pip安装python库的时候经常会遇到超时而无法下载的问题,解决办法如下: 一,首先在下面文件夹下建立一个pip文件夹 C:\Users\Administrator\AppData\Roaming 然后在pip文件夹下新建一个文件pip.ini,内容: ... -
pip安装sqlite3
2020-04-07 17:25:14pip安装sqlite3 pip install pysqlite3 -
python pip 安装一些包找不到的问题 Could not find a version that satisfies....
2018-04-13 10:54:39有时我们使用下载python 自带的pip 安装一些工具包时,会报如下错误找不到满意的版本,这时就是我们的pip可能需要升级了,所以使用python -m pip install --upgrade pip升级一下pip ,--upgrade 后面跟的是需要升级... -
使用pip安装模块时提示: No module named pip
2018-08-21 14:04:42使用pip安装模块时提示: No module named pip 今天使用pip安装模块提示错误信息: No module named pip windows 解决方法: >>> python -m ensurepip Ignoring indexes: ... -
linux pip安装
2018-07-07 11:19:04yum install pthon-pip然后就可以使用pip安装各种模块了 -
Django使用pip安装
2018-08-29 15:45:161.pip安装 pip是python的包管理器,使用这个工具可以很轻松安装各种python库 直接运行 pip install django 然后就可以安装了。 1.1安装问题 输入 pip install django 报错,说权限不够,于是选择 sudo ... -
使用pip安装Opencv
2019-12-23 21:24:37使用pip安装Opencv应该是最快最简单的安装方式了 pip install opencv-contrib-python 如果pip原始源下载慢的话可以考虑使用国内源: pip3 install opencv-contrib-python -i ... -
解决pip安装tensorflow中出现的no module named tensorflow.python 问题
2018-09-08 00:03:32解决pip安装tensorflow中出现的no module named tensorflow.python 问题 本人这两天弄一个神经网络,以前都是用的tensorflow+keras,其中tensorflow都是用的cpu版本,因为图方便 ,也觉得够用就没必要折腾了。然后... -
查看python安装路径以及pip安装的包
2018-05-24 16:08:08window下命令where python查看pip安装了多少包pip list如果电脑有两个python,一个python2,一个python3,使用上面的命令查看的是python3中pip安装的包。要查看python2pip安装的包,如下:python2 -m pip list 同理要... -
Python使用pip安装报错ModuleNotFoundError: No module named 'pip._internal.cli.main'的解决方法
2020-04-26 09:43:18Python使用pip安装报错ModuleNotFoundError: No module named 'pip._internal.cli.main’的解决方法 大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博客地址... -
pip安装tensorflow的坑
2018-07-13 18:49:34不过用Python遇到了pip安装,真的赞,可是在用pip装tensorflow,竟然抛错?????黑脸。。一.一开始中途报错,可能是网问题,所以报times out(猜测)后来发现可能是pip命令不对我是cpu,应该选2,之前写的1.二.后来... -
TensorFlow pip安装指定版本命令
2017-08-26 11:57:02通过pip安装TensorFlow指定版本命令: cpu版本:pip install tensorflow==1.2.1 (==后面为所要安装的版本号) gpu版本类似:pip install tensorflow-gpu==1.2.1 -
利用pip安装cv2
2020-04-24 18:51:37利用pip安装cv2: pip install opencv-python -
Mac使用pip安装tensorflow
2017-12-03 01:33:28一、参考文献 官网英文版安装教程:... 二、pip安装方法 1. 验证pip是否安装成功 在安装python时,pip就已经安装好了,我们用下面的命令验证一下 $ pip -V # for Python 2.7 $ pip3 -V # fo... -
解决pip安装tensorflow慢的问题
2019-06-23 00:20:40遇到pip安装tensorflow慢的原因是默认使用了国外的镜像包 由于墙的问题导致安装缓慢 这时候可以使用豆瓣的tensorflow镜像即可,打开cmd,输入如下命令即可: python -m pip install tensorflow -i ... -
使用python的pip安装模块
2017-12-29 15:40:45pip安装一般只有python3自带,python2需要自己下载安装,使用pip安装python的第三方模块,非常的方便 pip在python的安装路径下的script中,例如:我将python安装在c盘,pip在python3/scripts下,除了pip,还有pip3... -
pip 安装指定版本
2017-07-10 13:09:52pip 安装指定版本 参考: pip 安装特定版本的 Python 包 pip install -v pycrypto==2.3 pip指定安装包版本 – walker的流水账 – 51CTO技术博客 版本范围符号:==、>=、、 pip install cchardet ... -
pip安装uwsgi报错
2018-10-29 15:18:28pip安装uwsgi是报以下错误: [root@localhost ~]# pip install uwsgi Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-uqbRn0/uwsgi/setup.py’;f=getattr... -
pip安装opencv详细步骤
2020-02-18 20:26:351 一般我们都是使用pip安装,首先明确自己的pip在哪个文件里,这个site-packages就是安装第三方库的老巢 2 打开开始菜单的Anaconda Prompt,进入site-packages文件:输入cd/dE:\Anaconda\Lib\site-packages, 回车, ...
-
实现 MySQL 读写分离的利器 mysql-proxy
-
NFS 实现高可用(DRBD + heartbeat)
-
零基础极简以太坊智能合约开发环境搭建并开发部署
-
linux ubuntu 国内apt源 国内conda源 国内pip源 国内镜像加速 linux加速安装各种软件【亲测可用】【解决方案】
-
FTP 文件传输服务
-
2012-2015年中级互联网技术真题.pdf
-
基于Hypervisor虚拟化技术的Hadoop云平台管理方案的研究.docx
-
[蓝桥杯] 骰子迷题 python解法
-
从Docker到Kubernetes之技术实战.pdf
-
opencv.zip
-
MPC第1期.rar
-
MySQL Router 实现高可用、负载均衡、读写分离
-
第 229 场周赛记录(460 / 3483 )
-
搭建etcd集群时,报错etcd: request cluster ID mismatch错误解决,只适用于新建etcd集群或无数据集群
-
【布道者】Linux极速入门
-
基于Flink+Hudi构建企业亿级云上实时数据湖教程(PC、移动、小
-
【Python-随到随学】 FLask第一周
-
计算机网络:单播,多播
-
关于pytorch语义分割二分类问题的两种做法
-
MySQL 四类管理日志(详解及高阶配置)