2017-01-23 37 views
1

本地nexus服務器已被設置爲我們的pip本地服務器。 我想使用上述本地服務器來安裝一個樣本/測試類(繼承)。 上傳到本地服務器是成功的,但在使用此命令進行安裝:Nexus存儲庫管理器作爲pip本地服務器不能正常工作

pip install -i http://<nexus-ip>:8081/repository/pypi-all/pypi inherits 

導致此:

Could not find a version that satisfies the requirement inherits 
    (from versions:) 
    No matching distribution found for inherits 

我也嘗試了這些命令,但結果是一樣的:

pip install inherits 
pip install -i http://<nexus-ip>:8081/repository/pypi-all/pypi inherits-0.1 
pip install -i http://<nexus-ip>:8081/repository/pypi-all/pypi inherits==0.1 

Here're the contents of my〜/ .pypirc:

[distutils] 
index-servers = 
    nexus 
    pypi 

[nexus] 
username: my-username 
password: mypassword 
repository: http://<nexus-ip>:8081/nexus/repository/pypi-internal/ 

[pypi] 
... 

我這裏還有內容我〜/的.config/PIP/pip.conf

[global] 
index = http://<nexus-ip>:8081/repository/pypi-all/pypi 
index-url = http://<nexus-ip>:8081/repository/pypi-all/simple 

如所提到的,使用下面的命令上傳成功:從關係服務器

python setup.py sdist upload -r nexus 

響應是這裏(即表示上傳的內容是全成):

creating inherits-0.1 
creating inherits-0.1/inherits 
creating inherits-0.1/inherits.egg-info 
copying files to inherits-0.1... 
copying setup.cfg -> inherits-0.1 
copying setup.py -> inherits-0.1 
copying inherits/__init__.py -> inherits-0.1/inherits 
copying inherits/addmult.py -> inherits-0.1/inherits 
copying inherits/inherits.py -> inherits-0.1/inherits 
copying inherits/subdiv.py -> inherits-0.1/inherits 
copying inherits.egg-info/PKG-INFO -> inherits-0.1/inherits.egg-info 
copying inherits.egg-info/SOURCES.txt -> inherits-0.1/inherits.egg-info 
copying inherits.egg-info/dependency_links.txt -> inherits-0.1/inherits.egg-info 
copying inherits.egg-info/top_level.txt -> inherits-0.1/inherits.egg-info 
Writing inherits-0.1/setup.cfg 
Creating tar archive 
removing 'inherits-0.1' (and everything under it) 
running upload 
Submitting dist/inherits-0.1.tar.gz to http://<nexus-ip>:8081/nexus/repository/pypi-internal/ 
Server response (200): OK 

的setup.py的內容是基本的細節:

#!/usr/bin/env python 

import os 
import sys 

try: 
    from setuptools import setup 
except ImportError: 
    from distutils.core import setup 

requires = [] 

setup( 
    name = "inherits", 
    packages = ["inherits"], 
    version = '0.1', 
    description = 'Example inherits package', 
    #url = "", 
    #download_url = "", 
    author = "Jayson Pryde", 
    classifiers = [], 
) 

就如何解決這一點,使PIP安裝工作的任何想法?提前致謝!

+1

用'--verbose'標誌嘗試你的'pip install'命令獲取更多信息? –

回答

4

如果有人遇到同樣的問題並對解決方案感興趣,這裏有兩件事我做了。

1.使用此執行PIP:

pip install inherits -i http://<nexus-ip>:8081/nexus/repository/pypi-all/simple -v --trusted-host <nexus-ip> 

的-v和--trusted主機參數都是可選的

2.將您的〜/的.config /畫中畫/ PIP。 CONF到〜/將該.pip/pip.conf和執行:

pip install inherits -v —trusted-host <nexus-ip> 

只有#2中遇到的挑戰是PIP將始終連接到TH e聯繫服務器。所以如果我想連接到pypi.org,我必須首先重命名pip.conf。

希望這可以幫助別人!

+0

非常感謝分享! – jaysonpryde

+0

您使用的是哪個版本的Nexus,具有相同的問題 – JamesC

+0

只是爲了強調:在選項#1中使用'/ simple'而不是'/ pypi'非常重要 –

0

我遇到了同樣的問題,我通過在Nexus上爲我的匿名用戶添加pypip-read和pypip-browse角色來解決此問題。

相關問題