我可以使用私有的本地devpi服务器通过pip安装我的软件包。对应的配置为:
[global]
index_url = http://mydevpi.mine/root/pypi/+simple/
[search]
index = http://mydevpi.mine/root/pypi/
[install]
trusted-host = mydevpi.mine然后使用pip进行安装非常简单:
pip install -r requirements.txt但对pipenv做同样的事情似乎行不通。这是可行的,但没有使用我的本地devpi
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"这是行不通的:
[[source]]
url = "http://devpi.dgv/root/pypi/+simple/"
verify_ssl = true
name = "pypi"我如何告诉pipenv为pypi使用另一个url?
发布于 2018-09-12 23:54:35
提供的示例假定默认安装pypi服务器。
管道文件:Method1
[[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:命令行
$ 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:8080Method3:环境变量
export PIPENV_PYPI_MIRROR=http://localhost:8080发布于 2018-04-25 19:24:22
也许,我可以澄清一点,因为我遇到了类似的问题。没有错误消息,但我看到大量到pypi.org的流量(这种流量是不需要的)
我在我的主机文件中屏蔽了pypi.org,并想强制使用我的devpi服务器,但是,pipenv安装失败了。
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)
https://stackoverflow.com/questions/49536499
复制相似问题