2017-01-23 83 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角色来解决此问题。

相关问题