Using a Debian-based Linux distro (Kali) for Python programming (note that I am very new to Linux, had it for less than 2 months). Installed Python and GitKraken the usual way with apt-get install
.
Started happily coding using the 3.5.3 IDLE, but when I tried to use pip commands to install modules (all of this as root user), I found it was installing to /usr/local/lib/python2.7/dist-packages
rather than the Python 3.5.3 location (/usr/local/lib/python3.5/dist-packages
).
When I used pip install module
, it installed all modules to the 2.7 location. Because the Terminal used 2.7 by default (for whatever reason), using ./code.py
always ran code using Python 2.7, but I wrote the code for Python 3.5 (not the version the modules were installed for).
I saw some other answers on this website for similar problems, where you have to install new modules and change the PYTHONPATH
variable and assign aliases, but it messed more stuff up. Now echo $PYTHONPATH
returns nothing, and pip still installs to the Python 2.7 location.
I used apt-get
to install python-pip3 and I use the pip3 command to install modules, but whenever I use ./code.py
(my main method to run code), it still uses Python 2.7. How can I change this?