首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用私有devpi服务器和pipenv

使用私有devpi服务器和pipenv
EN

Stack Overflow用户
提问于 2018-03-28 21:56:56
回答 2查看 3.4K关注 0票数 5

我可以使用私有的本地devpi服务器通过pip安装我的软件包。对应的配置为:

代码语言:javascript
复制
[global]
index_url = http://mydevpi.mine/root/pypi/+simple/

[search]
index = http://mydevpi.mine/root/pypi/

[install]
trusted-host = mydevpi.mine

然后使用pip进行安装非常简单:

代码语言:javascript
复制
pip install -r requirements.txt

但对pipenv做同样的事情似乎行不通。这是可行的,但没有使用我的本地devpi

代码语言:javascript
复制
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

这是行不通的:

代码语言:javascript
复制
[[source]]

url = "http://devpi.dgv/root/pypi/+simple/"
verify_ssl = true
name = "pypi"

我如何告诉pipenvpypi使用另一个url?

EN

回答 2

Stack Overflow用户

发布于 2018-09-12 23:54:35

提供的示例假定默认安装pypi服务器。

管道文件:Method1

代码语言:javascript
复制
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[[source]]
url = "http://localhost:8080"
verify_ssl = false
name = "home"

[dev-packages]

[packages]
requests = {version="*", index="home"}
beautifulsoup4 = {version="*", index="home"}
pandas = "*"

Method2:命令行

代码语言:javascript
复制
$ pipenv install --pypi-mirror http://localhost:8080

$ pipenv update --pypi-mirror http://localhost:8080

$ pipenv sync --pypi-mirror http://localhost:8080

$ pipenv lock --pypi-mirror http://localhost:8080

$ pipenv uninstall --pypi-mirror http://localhost:8080

Method3:环境变量

代码语言:javascript
复制
export PIPENV_PYPI_MIRROR=http://localhost:8080

Pipenv Docs - Advanced

票数 3
EN

Stack Overflow用户

发布于 2018-04-25 19:24:22

也许,我可以澄清一点,因为我遇到了类似的问题。没有错误消息,但我看到大量到pypi.org的流量(这种流量是不需要的)

我在我的主机文件中屏蔽了pypi.org,并想强制使用我的devpi服务器,但是,pipenv安装失败了。

代码语言:javascript
复制
Current constraints:
  ipykernel

Finding the best candidates:

INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 10.56.0.120
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): wiki.pm1a.com
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F344518>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (2): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F344B00>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (3): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33EB70>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (4): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33E438>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (5): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33E208>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (6): pypi.org
Traceback (most recent call last):
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\util\connection.py", line 98, in create_connection
    raise err
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\util\connection.py", line 88, in create_connection
    sock.connect(sa)

我猜,这与github上的以下问题密切相关:https://github.com/pypa/pipenv/issues/1783

编辑:在不访问pypi.org的情况下,运行pipenv install --skip-lock似乎解决了在devpi (或类似的东西)上运行的问题。这至少是我的解决方案(使用pipenv 11.10.0和python 3.6.4)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49536499

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档