最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】如何使用pip去本地安装Python的包文件

Python crifan 13896浏览 0评论

折腾:

【已解决】Flask中SQLAlchemy的pagination传入page为2时出错:LookupError “” is not among the defined enum values

期间,看到通过pip去下载太慢:

(RunningFast) ➜  staging pip install -U SQLAlchemy
Collecting SQLAlchemy
  Downloading SQLAlchemy-1.1.3.tar.gz (5.1MB)
    0% |▏                               | 20kB 2.3kB/s eta 0:37:31

想要去:

自己手动下载后,

再去通过pip安装本地已下载好的包

Download – SQLAlchemy

-》

SQLAlchemy 1.1.3 : Python Package Index

-》

https://pypi.python.org/packages/84/83/322a268e3187c088aa2867c2560869227da5fc7b9a697c5e382df811bd3c/SQLAlchemy-1.1.3.tar.gz#md5=d3a1e8d18f1e51a561db339b847ede0f

-》

https://pypi.python.org/packages/84/83/322a268e3187c088aa2867c2560869227da5fc7b9a697c5e382df811bd3c/SQLAlchemy-1.1.3.tar.gz

pip install local

Installing Python packages from local file system folder with pip – Stack Overflow

pip install mypackage –no-index –find-links file:///srv/pkg/mypackage

(RunningFast) ➜  stable pip install SQLAlchemy –no-index –find-links ./SQLAlchemy-1.1.3.tar.gz
Ignoring indexes: https://pypi.python.org/simple
Requirement already satisfied (use –upgrade to upgrade): SQLAlchemy in /root/Envs/RunningFast/lib/python2.7/site-packages
(RunningFast) ➜  stable pip install -U SQLAlchemy –no-index –find-links ./SQLAlchemy-1.1.3.tar.gz    
Ignoring indexes: https://pypi.python.org/simple
Collecting SQLAlchemy
Building wheels for collected packages: SQLAlchemy
  Running setup.py bdist_wheel for SQLAlchemy … done
  Stored in directory: /root/.cache/pip/wheels/69/24/81/b54efd67b032c8097436294d5cc8e8a5a05b4669295827c40e
Successfully built SQLAlchemy
Installing collected packages: SQLAlchemy
  Found existing installation: SQLAlchemy 1.1.1
    Uninstalling SQLAlchemy-1.1.1:
      Successfully uninstalled SQLAlchemy-1.1.1
Successfully installed SQLAlchemy-1.1.3

【总结】

用pip从本地安装某个库的话,可以用:

pip install PackageName –no-index –find-links file:///path/to/your/package

比如:

我此处升级对应的SQLAlchemy:

pip install -U SQLAlchemy –no-index –find-links ./SQLAlchemy-1.1.3.tar.gz

转载请注明:在路上 » 【已解决】如何使用pip去本地安装Python的包文件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.166 seconds, using 22.11MB memory