Reputation: 33
When trying to run an app written in Python2, I run into an import error, but when looking into the files, they are all there?
All files related to python2-six:
python2-six /usr/
python2-six /usr/lib/
python2-six /usr/lib/python2.7/
python2-six /usr/lib/python2.7/site-packages/
python2-six /usr/lib/python2.7/site-packages/six-1.11.0-py2.7.egg-info/
python2-six /usr/lib/python2.7/site-packages/six-1.11.0-py2.7.egg-info/PKG-INFO
python2-six /usr/lib/python2.7/site-packages/six-1.11.0-py2.7.egg-info/SOURCES.txt
python2-six /usr/lib/python2.7/site-packages/six-1.11.0-py2.7.egg-info/dependency_links.txt
python2-six /usr/lib/python2.7/site-packages/six-1.11.0-py2.7.egg-info/top_level.txt
python2-six /usr/lib/python2.7/site-packages/six.py
python2-six /usr/lib/python2.7/site-packages/six.pyc
python2-six /usr/lib/python2.7/site-packages/six.pyo
python2-six /usr/share/
python2-six /usr/share/licenses/
python2-six /usr/share/licenses/python2-six/
python2-six /usr/share/licenses/python2-six/LICENSE
Upon running the program:
File "/usr/lib/python2.7/site-packages/configobj.py", line 22, in <module>
import six
ImportError: No module named six
My PYTHONPATH for Python2.7 is:
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0
How come the module isn't picked up? I should mention that I'm on Arch Linux, with Python 2.7 and Python 3.7 running side by side. With /usr/bin/python being symlinked to python3.
Upvotes: 0
Views: 191
Reputation: 1367
This usually means your environment isn't set up correctly. There's more to a virtual environment than symlinking the bin
path.
While in python 3 you can do python -m venv venv_name
, in python 2 you need to create a virtual environment to run.
How did you create your virtualenv?
I would activate the environment; source /path/to/bin/activate
.
Use pip list
command and see what it says.
Upvotes: 2