I have Python 2.7 installed, Im looking at trying tensorflow and for windows it looks like it only works on python 3.5, I downloaded the python installer and it is apparently installed, but where?
Python 2.7 has a Python27 directory in C:, but I cant locate 3.5 anywhere. I tried the installer again and it asked if I wanted to repair or remove.
EDIT: Im really trying to find pip3, which I assume is in the python35/scripts directory
Where is Python installed? or where is Python's HOME directory?
An easy way to find where Python is installed, would be to do:
import sys
print(sys.executable)
Which for me outputs:
C:\Users\Vallentin\AppData\Local\Programs\Python\Python36-32\python.exe
You can also use sys.exec_prefix
which would be the equivalent of os.path.dirname(sys.executable)
.
If you then copy the directory part and paste it into Windows Explorer. Then it would take you to Python's home directory. You are then correct that pip would be located at.
C:\Users\Vallentin\AppData\Local\Programs\Python\Python36-32\Scripts\pip3.exe
From a command line this can also be done in a single line:
python -c "import sys; print(sys.executable)"
Alternatively you can also do:
which python
(Unix)where python
(Windows)Where is a Python module installed?
If you want to find where a Python module is located, then like print(__file__)
the same can be done with modules:
import re
import flask
print(re.__file__)
print(flask.__file__)
Which for me outputs:
C:\Users\Vallentin\AppData\Local\Programs\Python\Python36-32\lib\re.py
C:\Users\Vallentin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask-0.12-py3.6.egg\flask\__init__.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With