zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Python: pip

2023-09-11 14:16:17 时间

pip documentation v22.0.3 (pypa.io)

configuration: https://pip.pypa.io/en/stable/topics/configuration/

pip: package installer for Python

 

file name convertion:

https://peps.python.org/pep-0427/#file-name-convention

pip-9.0.1-py2.py3-none-any.whl is the version 9.0.1 build of the pip package, compatible with both Python 2 and 3, with no ABI - Application Binary Interface (pure Python), and compatible with any CPU architecture.

 

 (VCS Support):

 
pip install git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6
 

Instructions to install from private repo using ssh credentials:

$ pip install git+ssh://git@github.com/myuser/foo.git@my_version

To install a package from a subdirectory, say stackoverflow

$ pip install git+ssh://git@github.com/myuser/foo.git@my_version#subdirectory=stackoverflow
 
 

This worked like charm:

pip3 install git+https://github.com/deepak1725/fabric8-analytics-worker.git@develop

Where :

develop: Branch

fabric8-analytics-worker.git : Repo

deepak1725: user

 

For HTTP

pip install git+https://github.com/<project_owner>/<project_name>
git+https://<your personal token>@github.com/mylibrary.git#egg=mylibrary

For SSH

pip install git+ssh://git@github.com/<project_owner>/<project_name>.git

  pip install -e git+ssh://git@github.corp.ebay.com/krylov/pykrylov.git@master#egg=pykrylov

For Local Git Repository

pip install git+file///path/to/your/git/project/

 

PyPi: Python package index

 

   

Linux:

配置文件路径:/etc/pip.conf  ~/.pip/pip.conf

 

Windows:

配置文件路径:%appdata%\pip\pip.ini  %userprofile%\pip\pip.ini

 

常用配置:

 

[global]
index-url=http://mirrors.aliyun.com/pypi/simple
extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple
# proxy=http://user:password@proxy_name:port
timeout=120
trusted-host=mirrors.aliyun.com
quiet=0
verbose=2


[install]
ignore-installed=true
no-compile=false
no-dependencies=false
no-warn-script-location=false


[freeze]
timeout=10

 

 

 

常用用法: 

  1. pip search -v
  2. pip installpip uninstall
    1. pip install --requirement | -r requirements             Install from the given requirements file
    2. pip install --upgrade | -U              Upgrade all specified packages
  3. pip list -v                    list installed packges  
  4. pip freeze -v  Ouput installed packges in requirements format
  5. pip show       Show information about installed packages
    pip show -f | --files   Show the full list of installed files
  6. pip completion --bash >> .bash_profile      Command completion
  7. for b in $(pip list --outdated | tail -n +3 | awk '{print $1}');do pip install --upgraed $b;done    升级所有--outdated包
  8. pip install tea 'cup >= 3.13'

whl安装和使用:

wheel文件的本质就是zip或rar,其方便python的安装和使用,pip install.

scikit_learn‑0.19.1‑cp27‑cp27m‑win32.whl

cp27  <==> cpython2.7

win32 <==> 32bits

cp37 <==> cpython3.7

win_amd64 <==> 64bits

whl下载站:https://www.lfd.uci.edu/~gohlke/pythonlibs/