【问题标题】:Installing Python packages from local file system folder with pip使用 pip 从本地文件系统文件夹安装 Python 包
【发布时间】:2018-06-14 20:28:31
【问题描述】:

我正在尝试使用pip 从本地文件系统安装python 包,如question 中所述。

我已按照上述问题中接受的答案中的建议使用pip2pi。

dmanna@ubuntu:~$ mkdir -p pyt/pkg
dmanna@ubuntu:~$ pip2tgz pyt/pkg/ patroni[zookeeper]

下载的包

dmanna@ubuntu:~$ ls /home/dmanna/pyt/pkg/
cdiff-1.0.tar.gz
certifi-2018.4.16-py2.py3-none-any.whl
chardet-3.0.4-py2.py3-none-any.whl
click-6.7-py2.py3-none-any.whl
idna-2.7-py2.py3-none-any.whl
kazoo-2.5.0-py2.py3-none-any.whl
patroni-1.4.4.tar.gz
prettytable-0.7.2.tar.bz2
psutil-5.4.6.tar.gz
psycopg2-2.7.4.tar.gz
python_dateutil-2.7.3-py2.py3-none-any.whl
pytz-2018.4-py2.py3-none-any.whl
PyYAML-3.12.tar.gz
requests-2.19.1-py2.py3-none-any.whl
six-1.11.0-py2.py3-none-any.whl
tzlocal-1.5.1.tar.gz
urllib3-1.23-py2.py3-none-any.whl

然后,当我尝试从上述本地目录安装所需的软件包时。它给了我以下错误

dmanna@ubuntu:~$ sudo pip install --no-index --find-links=pyt/pkg/patroni-1.4.4.tar.gz patroni[zookeeper]
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking patroni[zookeeper]
  Running setup.py (path:/tmp/pip_build_root/patroni/setup.py) egg_info for package patroni

  Installing extra requirements: 'zookeeper'
Downloading/unpacking urllib3>=1.19.1,!=1.21 (from patroni[zookeeper])
  Could not find any downloads that satisfy the requirement urllib3>=1.19.1,!=1.21 (from patroni[zookeeper])
Cleaning up...
No distributions at all found for urllib3>=1.19.1,!=1.21 (from patroni[zookeeper])
Storing debug log for failure in /home/dmanna/.pip/pip.log

谁能告诉我我做错了什么?

Python - 2.7.6 画中画 - 1.5.4 Ubuntu 14.04

【问题讨论】:

    标签: python python-2.7 pip


    【解决方案1】:
    --find-links=pyt/pkg
    

    在目录中查找链接,而不是在 patroni-1.4.4.tar.gz 存档中。

    【讨论】:

    • 还有一个查询。如果我运行sudo pip install --no-index --find-links=file://pyt/pkg/ patroni[zookeeper],那么它会因错误Ignoring indexes: https://pypi.python.org/simple/ Downloading/unpacking patroni[zookeeper] Could not find any downloads that satisfy the requirement patroni[zookeeper] Cleaning up... No distributions at all found for patroni[zookeeper] Storing debug log for failure in /home/dmanna/.pip/pip.log 而失败。知道为什么 file:/// 会失败吗?
    • 为什么你认为它应该起作用?它必须是目录或带有链接的 html 文件。 file:// URL 两者都不是。
    猜你喜欢
    • 2013-02-08
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 2013-04-20
    相关资源
    最近更新 更多