python3
Python 3.9.6 (default, Jul 14 2021, 09:15:03)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/uno/__init__.py", line 4, in <module>
from base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
ImportError: cannot import name 'Element' from 'base' (/usr/local/lib/python3.9/site-packages/base/__init__.py)
>>>
检查uno
中的文件
ls /usr/local/lib/python3.9/site-packages/uno
base.py constants.py core.py css_constants.py decorators.py field.py form.py helpers.py __init__.py input_elements.py __pycache__ quickadder.py search.py
它在文件中为空
ls -al /usr/local/lib/python3.9/site-packages/base/__init__.py
-rw-r--r-- 1 root root 0 Jun 23 2016 /usr/local/lib/python3.9/site-packages/base/__init__.py
修复/usr/local/lib/python3.9/site-packages/uno/__init__.py
中的行
from .base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
再次重新导入:
python3
Python 3.9.6 (default, Jul 14 2021, 09:15:03)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/uno/__init__.py", line 4, in <module>
from .base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
File "/usr/local/lib/python3.9/site-packages/uno/base.py", line 129
print 'new css', self._attr, 'value:', value
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('new css', self._attr, 'value:', value)?
模块uno
是用python2
编写的。
现在安装python3支持的uno
debian@debian:~$ sudo apt install python3-uno
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-uno is already the newest version (1:6.1.5-3+deb10u7).
0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.
debian@debian:~$ python3
Python 3.9.6 (default, Jul 14 2021, 09:15:03)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import python3-uno
File "<stdin>", line 1
import python3-uno
^
SyntaxError: invalid syntax
>>> import uno
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/uno/__init__.py", line 4, in <module>
from .base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
File "/usr/local/lib/python3.9/site-packages/uno/base.py", line 129
print 'new css', self._attr, 'value:', value
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('new css', self._attr, 'value:', value)?
如何导入我已经安装的python3-uno
目前没有回答
相关问题 更多 >
编程相关推荐