诸神缄默不语-个人CSDN博文目录

最近更新:2023.6.20
最初更新:2021.12.8

  1. pip简介:一种用于管理Python包的工具

  2. pip文档User Guide – pip documentation v22.1.1

  3. virtualenvconda create虚拟环境下直接使用pip,就可以将包安装指定环境下。如果不在Python环境下,需要命令行前面加上 python -m(如果Python解释器不在默认路径,就用完整解释器路径,举例:/home/myusername/anaconda3/envs/envname/bin/python -m

  4. pip install

    1. 直接安装包示例代码pip install numpy(一般建议参考官网pypi官网,了解具体的包安装方式
    2. 可以直接通过这一方式安装最新版本的常用包(不便直接使用pip install的包一般都在其官网有写具体的安装方式部分包我撰写过相应的安装指南
      1. numpypip install numpy
      2. scipypip install scipy 官网安装教程SciPy – Installation
      3. scikitlearn (sklearn):pip install scikit-learn 官网下载教程Installing scikit-learn — scikit-learn 1.1.1 documentation
      4. matplotlib: pip install matplotlib 官网入门教程Getting started — Matplotlib 3.5.3 documentation
      5. wordcloudpip install wordcloud pypi网站wordcloud · PyPI(虽然网页上只说测试到了Python3.7,其实Python3.8也能用),文档WordCloud for Python documentation — wordcloud 1.8.1 documentation官方博文A Wordcloud in Python,GitHub项目amueller/word_cloud: A little word cloud generator in Python
      6. gensimpip install gensim 官网:Gensim: Topic modelling for humans
      7. pyLDAvis:pip install pyldavis 官方文档pyLDAvis — pyLDAvis 2.1.2 documentation
      8. tqdmpip install tqdm 官方GitHub项目tqdm/tqdm: A Fast, Extensible Progress Bar for Python and CLI
      9. seabornpip install seaborn 官网下载教程:Installing and getting started — seaborn 0.11.2 documentation
      10. sentence_transformers: pip install sentence_transformers 官网:sentence-transformers (Sentence Transformers)
      11. pybind11:pip install pybind11 官网下载教程:Installing the library — pybind11 documentation
    3. 指定安装某一版本的包,示例代码pip install numpy==1.14
    4. 通过源码安装包(以textgen包1为例):
    git clone https://github.com/shibing624/textgen.git
    cd textgen
    python setup.py install
    

    通过源码安装包,在源码更新时同时更新包的方法
    (待补)

    1. 如果出现网络问题等,无法直接通过包名下载,也可以指定包的whl文件下载后,通过pip直接安装whl文件示例代码pip install torch_scatter-2.0.9-cp39-cp39-linux_x86_64.whl
    2. 参数
      1. --upgrade-U 更新包到最新版本,示例代码pip install --upgrade numpy(文档地址https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-U
      2. 参数 --pre 下载prereleasedevelopment版本。(默认情况下pip会搜索stable版本的包) 示例代码:pip install --pre dgl-cu102 -f https://data.dgl.ai/wheels-test/repo.html
      3. 参数 -i 指定源,示例代码:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple cogdl清华使用方法参考pypi | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
      4. 参数 -e, --editable <path/url>editable mode,从本地项目路径一个VCS URL安装包示例代码:pip install -e .
      5. 参数 --user 安装到Python用户的install directory里,一般来说是~/.local/,Windows平台一般是%APPDATA%Python可以查看Python文档里的site.USER_BASE(对应网址site — Site-specific configuration hook — Python 3.10.4 documentation)来了解详情。(文档地址:https://pip.pypa.io/en/stable/cli/pip_install/#install-user
      6. 参数 -i, --index-url <url> Python搜索位置默认值https://pypi.org/simple
      7. 参数 --extra-index-url <url> --index-url的补充超链接
      8. 参数 -f- 可以指定在某网页中搜索下载指定版本的包(一般都是包官方给出的安装方式),示例代码:pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cu102.html
  5. pip show 展示包的信息示例代码:pip show numpy
    打印信息

Name: numpy
Version: 1.21.2
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD
Location: /home/myusername/anaconda3/envs/envname/lib/python3.8/site-packages
Requires: 
Required-by: transformers, torchvision, torch, scipy, pandas, mkl-random, mkl-fft, matplotlib
  1. pip list 打印已安装的包的简略信息
    打印示例部分):
Package                       Version
----------------------------- ----------
anyio                         3.4.0
argon2-cffi                   20.1.0
async-generator               1.10
attrs                         21.2.0
Babel                         2.9.1
backcall                      0.2.0
backports.functools-lru-cache 1.6.4
  1. pip cache dir 打印pip的cache文件夹
  2. pip cache purge 手动清除缓存2
  3. which pip 打印pip的路径

  1. shibing624/textgen: TextGen: Implementation of Text Generation models, include LLaMA, BLOOM, GPT2, BART, T5, SongNet and so on. 文本生成模型,实现了包括LLaMA,ChatGLM,BLOOM,GPT2,Seq2Seq,BART,T5,UDA等模型的训练和预测,开箱即用。 ↩︎

  2. 【Python】pip安装库时存在缓存(及清除方法)_pip清理缓存的包_爱打瞌睡的CV君的博客-CSDN博客 ↩︎

原文地址:https://blog.csdn.net/PolarisRisingWar/article/details/121791044

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_33068.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注