Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 2.7 still accessing Python 3.4 directories

I installed Python 2.7 when I had already installed Python 3.4 on my system.

Now when I try to run python27 it still tries to access the Python 3.4 folders and thus getting errors.

C:\Users\user>python27
  File "E:\Python\Lib\site.py", line 176
    file=sys.stderr)
        ^
SyntaxError: invalid syntax

It should access E:\Python27 (which contains 2.7) instead of E:\Python (which contains 3.4).

The version and commands work:

C:\Users\Lorenz>python --version
Python 3.4.3

C:\Users\Lorenz>python27 --version
Python 2.7.9

I have both versions of Python in the environment variables.

EDIT: I just deleted all related 3.4 environment variables, and weirdly now, both 2.7 and 3.4 work.

like image 947
Lorenz Leitner Avatar asked Feb 01 '26 18:02

Lorenz Leitner


1 Answers

As long as you don't need environment variables (e.g. PYTHONPATH) for both installations, it'll be working for you. However I strongly suggest using virtualenv, it helps with isolating problems related to libraries AND installed interpreters.

Also nice guide.

like image 149
knitti Avatar answered Feb 04 '26 06:02

knitti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!