0

I used to use pyenv as my version manager but it had too much trouble installing packages so I'm moving over to virtualenv. So when I activate my virtual environment and write: which python I get:

/Users/kylefoley/codes/venv/bin/python

But when I actually use python it seems that it is still using pyenv. For example:

(venv) Admins-MacBook-Pro-4:~ kylefoley$ python
Python 3.8.0 (default, Nov 28 2019, 02:43:40) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Tk'
>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Tkinter'
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kylefoley/.pyenv/versions/3.8.0/lib/python3.8/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

I'm not trying to fix the problem of not being able to use Tkinter rather I just want to understand why this line:

File "/Users/kylefoley/.pyenv/versions/3.8.0/lib/python3.8/tkinter/__init__.py", line 36, in <module>

is coming up.

logic1976
  • 519
  • 1
  • 6
  • 19
  • Maybe you need to check PATH file, python may be running from the specified one – pedro_bb7 Nov 29 '19 at 08:49
  • Have you tried [unistalling pyenv](https://github.com/pyenv/pyenv#uninstalling-pyenv) following this guide? – Vanojx1 Nov 29 '19 at 08:50
  • @vanojx1 I cannot uninstally pyenv because I need python to be working at all times. I cannot uninstall one version control manager until I get another version control manager to work. – logic1976 Nov 29 '19 at 08:51
  • @eggrobot, I'm not sure what you mean but if you're referring to the bash_profile, I couldn't get Python to change its interpreter based on what is written in the bash_profile. In my bash_profile I tried writing: `export PYTHONPATH="/usr/local/Cellar/python/3.8.0/bin/python3:$PYTHONPATH"` but that was never able to change which version of Python I was using. – logic1976 Nov 29 '19 at 08:55

1 Answers1

0

It's because I created the virtual environment when my version management was still pyenv. If I eliminate that version management, then I do not get the file pyenv.cfg but instead get the file: pip selfcheck.json which is located in the virtual environment directory together which lib, bin and include.

logic1976
  • 519
  • 1
  • 6
  • 19