我一直在不停地问这个问题,因为我觉得我必须犯下一些脑死亡的错误。经过几周的挣扎,我仍然无法解决这个问题。
当我尝试导入urllib时,我收到500内部服务器错误。
我在我的requirements.txt文件中添加了urllib。
“git push -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
任何帮助都非常感谢!
答案 0 :(得分:2)
在Python 3.x +中,urllib已分为urllib.request,urllib.error等。这可能是你的问题。