Reputation: 165
I'm trying to import tkSnack from Python3 in Debian 10.
I have already installed tkSnack from apt:
apt-get install python3-tksnack
Anyway, when trying to import tkSnack module frome python3:
ModuleNotFoundError: No module named 'tkSnack'
I have also tried to install tkSnack from pip, but the following error message appears:
ERROR: Command errored out with exit status 1:
command: /home/cooper/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x8rnbcp1/snack/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x8rnbcp1/snack/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-x8rnbcp1/snack/pip-egg-info
cwd: /tmp/pip-install-x8rnbcp1/snack/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-x8rnbcp1/snack/setup.py", line 47
print GCC_VERSION
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(GCC_VERSION)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It's strange that, when importing tkSnack in python2.7 all works well!
Does anyone have any idea about this? Thaks!
Upvotes: 0
Views: 1697
Reputation: 94483
There're 2 separate problems in your question so it'd be better if you've asked 2 different questions.
You installed the package with system package manager apt-get
but tried to use with local anaconda environment. That doesn't work: packages installed with system package managers should be used with system-installed python. To install packages into virtual environments (including anaconda) use conda
or pip
.
SyntaxError
in print
means the code is for Python2 only; in Python3 print
becomes a function and requires parenthesizes: print(GCC_VERSION)
. It seems you installed a wrong, Python2-only version of the package and is trying to use it with Python3. Uninstall it and reinstall with code update for Python3.
Upvotes: 1