Python Forum
setting pythonpath variable in environment variables
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setting pythonpath variable in environment variables
#1
parent/
    __init__.py
    one/
        __init__.py
        sample1.py
    two/
        __init__.py
        sample.py
  
I have a structure like above.The code works fine in PYCHARM IDE.To run the program through command prompt,I have set environment variables like PYTHON_HOME,PATH variables.Now when i run the code througb command prompt,it doesnt run like
<c:/users/parent>python two\sample.py.The error which i get is like "No module named one",as sample.py file has an import like "from one.sample1 import *" But when i set PYTHONPATH variable and run the code same way it runs.
PYTHONPATH is set as c:/users/parent
How can i understand this.?Is it correct way to run the code through command prompt?.Please help me to understand this
Reply


Messages In This Thread
setting pythonpath variable in environment variables - by saisankalpj - Dec-05-2018, 02:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to set PYTHONPATH in Visual Studio Code? aupres 5 4,532 Aug-15-2023, 03:51 PM
Last Post: snippsat
  Setting permanent user variables in Windows coder420 2 1,455 Jan-04-2022, 10:42 AM
Last Post: Larz60+
Question Calling on a Variable using other Variables jacknewport 4 2,044 Jul-23-2021, 04:18 PM
Last Post: jacknewport
  Create new variable dependent on two existing variables JoeOpdenaker 6 3,125 Oct-25-2020, 02:15 PM
Last Post: jefsummers
  Print variable values from a list of variables xnightwingx 3 2,679 Sep-01-2020, 02:56 PM
Last Post: deanhystad
  Help Setting Multiple Variables bzowk 0 1,623 Jul-18-2020, 06:59 PM
Last Post: bzowk
  the exe file by generated by pyinstaller ,can't get the PYTHONPATH roger2020 11 7,139 Jan-14-2020, 11:07 AM
Last Post: roger2020
  Trouble Setting a Variable True basing on an Imput VictorVictus 5 2,818 Aug-02-2019, 08:14 PM
Last Post: VictorVictus
  TESSDATA_PREFIX environment variable is set to your "tessdata" directory. rajeev1729 1 4,107 Jun-10-2019, 04:47 PM
Last Post: Gribouillis
  Help with environment path variables kuharido 0 1,953 Jun-07-2019, 09:18 PM
Last Post: kuharido

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020