Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python insert path

import sys
from os.path import abspath, dirname

sys.path.insert(0, dirname(dirname(abspath(__file__))))

path1 = dirname(abspath(__file__))  # current folder
path2 = dirname(path1)  # parent folder

print(path1)
print(path2)
Comment

add python to path

To add Python to the Windows Path, follow these steps:

1. Start the Run box and enter sysdm.cpl
2. In the System Properties window go to the Advanced tab and 
   click the Environment Variables button
3. In the System variable window, find the Path variable and 
   click Edit
4. Position your cursor at the end of the Variable value line 
   and add the path to the python.exe file, preceeded with 
   the semicolon character (;)
Comment

how to add path to python in windows

Simply add this path to your PYTHONPATH environment variable. 
To do this, go to Control Panel / System / Advanced / Environment variable, 
and in the "User variables" sections, check if you already have PYTHONPATH. 
If yes, select it and click "Edit", if not, click "New" to add it.

Paths in PYTHONPATH should be separated with ";".
Comment

PREVIOUS NEXT
Code Example
Python :: python turtle set screen size 
Python :: python turtle fill 
Python :: read specific columns from csv in python pandas 
Python :: python for loop with step 
Python :: python verificar se é numero 
Python :: beautifulsoup find text contains 
Python :: python max function recursive 
Python :: python access key in dictionary 
Python :: append two list of number to one python 
Python :: use map in python to take input 
Python :: how to convert pandas series to 2d numpy array 
Python :: sentence similarity python 
Python :: encrypt password with sha512 + python 
Python :: python opencv measure distance two shapes 
Python :: list get every 2nd element 
Python :: set value through serializer django 
Python :: continue statement python 
Python :: How to Adjust Title Position in Python 
Python :: encryption using python 
Python :: not in python 
Python :: how to take two space separated int in python 
Python :: assosciate keys as list to values in python 
Python :: flask url_for 
Python :: python3 check if object has attribute 
Python :: import flask session 
Python :: access myultiple dict values with list pythojn 
Python :: pandas read_excel 
Python :: django run management command from code 
Python :: celery timezone setting django 
Python :: A Python Class Constructor 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =