2015-02-10 102 views
2

我一直在问这个问题,因为我觉得我必须犯一些脑死的错误。经过几个星期的努力,我仍然无法解决这个问题。无法加载urllib python软件包

当我尝试导入urllib时,出现500内部服务器错误。

我在我的requirements.txt文件中添加了urllib。

“混帐推-a” 无法找到的urllib:

. . . 
    remote: Activating virtenv 
    remote: Checking for pip dependency listed in requirements.txt file.. 
. . . 
    remote: Collecting urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1)) 
    remote: DEPRECATION: Failed to find 'urllib' at http://mirror1.ops.rhcloud.com/mirror/python/web/simple/urllib/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}. 
    remote: Could not find any downloads that satisfy the requirement urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1)) 
    remote: No distributions at all found for urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1)) 

我已经配置的virtualenv上的规定: https://developers.openshift.com/en/python-getting-started.html#step3

virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/' 
virtualenv = os.path.join(virtenv, 'bin/activate_this.py') 
try: 
    # Multi-Line for Python v3.3: 
    exec_namespace = dict(__file__=virtualenv) 
    with open(virtualenv, 'rb') as exec_file: 
    file_contents = exec_file.read() 
    compiled_code = compile(file_contents, virtualenv, 'exec') 
    exec(compiled_code, exec_namespace) 
except IOError: 
    pass 

任何帮助,不胜感激!

回答

2

在Python 3.x +中,urllib已被分离为urllib.request,urllib.error等。这可能是您的问题。

+1

谢谢flyingjam。沿着这些线路,我只是尝试从urllib更改为urllib3,现在它的工作原理! – 2015-02-10 05:10:52