0

我正在尝试使用 Python 3.3 在 openshift 上部署我的 Django 项目(因为我的项目仅适用于 python3)ImportError: cannot import name find_spec当我检查日志文件时,我们发现了一个错误。

[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] from django.utils.module_loading import import_string
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] File "/var/lib/openshift/596f5f3822s71edsf000ad/python/virtenv/venv/lib/python3.3/site-packages/django/utils/module_loading.py", line 67, in <module>
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] from importlib.util import find_spec as importlib_find
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] ImportError: cannot import name find_spec

按照这些问题https://stackoverflow.com/a/34648720/6396981https://code.djangoproject.com/ticket/25868。Django 建议升级我的 Python,但在这种情况下,openshift 仅适用于 python 3.3.2。

[myapp-foobar.rhcloud.com 596f5f3822s71edsf000ad]\> python
Python 3.3.2 (default, Aug  5 2016, 06:46:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

当我检查墨盒时,Python 3.5 不可用:

➜  openshift git:(openshift) rhc app create
When creating an application, you must provide a name and a cartridge from the list below:

Short Name           Full name
==========           =========
diy-0.1              Do-It-Yourself 0.1
jbossas-7            JBoss Application Server 7
jboss-dv-6.1.0       JBoss Data Virtualization 6
jbosseap-6           JBoss Enterprise Application Platform 6
jboss-unified-push-1 JBoss Unified Push Server 1.0.0.Beta1
jboss-unified-push-2 JBoss Unified Push Server 1.0.0.Beta2
jenkins-1            Jenkins Server
nodejs-0.10          Node.js 0.10
perl-5.10            Perl 5.10
php-5.3              PHP 5.3
php-5.4              PHP 5.4
zend-6.1             PHP 5.4 with Zend Server 6.1
python-2.6           Python 2.6
python-2.7           Python 2.7
python-3.3           Python 3.3
ruby-1.8             Ruby 1.8
ruby-1.9             Ruby 1.9
ruby-2.0             Ruby 2.0
jbossews-1.0         Tomcat 6 (JBoss EWS 1.0)
jbossews-2.0         Tomcat 7 (JBoss EWS 2.0)
jboss-vertx-2.1      Vert.x 2.1
jboss-wildfly-10     WildFly Application Server 10
jboss-wildfly-8      WildFly Application Server 8.2.1.Final
jboss-wildfly-9      WildFly Application Server 9

有什么想法来处理这个吗?像将该 python 版本升级到 Python 3.5 之类的东西?

4

0 回答 0