Python Forum
How to run an exe file in the Scripts folder using py.exe?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run an exe file in the Scripts folder using py.exe?
#1
In my current setup python.exe is not added to the path. Instead I am using python launcher py.exe to launch python. Similarly I do not have pip.exe on path as well. So if I want to run pip.exe I use py -m pip.

Since pip.exe is in my <python_installation>/Scripts folder I am under the assumption that everything in that folder can be called via python launcher py.exe.

For example, I want to install jupyter using pip and the instruction here: https://jupyter.org/install tells me to run pip install jupyterlab. But as I am using py.exe I used py -m pip install jupyterlab instead.

Now I need to run the jupyter-lab.exe in the <python_installation>/Scripts folder to start jupyter. But as the scripts folder is not in my path - similar to pip - I used the following command, py -m jupyter-lab. But I get an error saying No module named jupyter-lab.

Is it possible to run jupyter-lab.exe using python launch py.exe? Is it possible to run exe file in Scripts folder without adding the folder to Path or without fully qualifying the location of exe file in the terminal?
Reply
#2
(Aug-18-2021, 08:46 AM)quazirfan Wrote: Now I need to run the jupyter-lab.exe in the <python_installation>/Scripts folder to start jupyter. But as the scripts folder is not in my path - similar to pip - I used the following command, py -m jupyter-lab. But I get an error saying No module named jupyter-lab.

Is it possible to run jupyter-lab.exe using python launch py.exe? Is it possible to run exe file in Scripts folder without adding the folder to Path or without fully qualifying the location of exe file in the terminal?
py want work to launch the jupyter-lab.exe(not a python module now),have to go into folder where jupyter-lab.exe when Scripts folder not in Path.
G:\div_code
λ c:

C:\Users\Tom
λ cd C:\Python39\Scripts

C:\Python39\Scripts
λ jupyter-lab
[I 2021-08-18 16:10:31.497 ServerApp] jupyterlab | extension was successfully linked.
For convenient should setup like explain her Python 3.9/3.8 and pip installation under Windows
Then Scripts folder is in Windows Path,and jupyter lab will work from anywhere in cmd or cmder as i use here.

Or can use virtual environment when activate it will launch with jupyter lab
Quick demo using py.
# Make
G:\div_code
λ py -m venv jup_env

# Cd in
G:\div_code
λ cd jup_env\

# Activate 
G:\div_code\jup_env
λ G:\div_code\jup_env\Scripts\activate.bat

# Install
(jup_env) G:\div_code\jup_env
λ pip install jupyterlab
Collecting jupyterlab .....

# Now that environment is active there is no messing with Path
(jup_env) G:\div_code\jup_env
λ jupyter lab
[I 2021-08-18 16:25:11.774 ServerApp] jupyterlab | extension was successfully linked.
quazirfan likes this post
Reply
#3
(jup_env) G:\div_code\jup_env
λ jupyter lab
Thanks this solves my problem.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Function not executing each file in folder mathew_31 9 603 Aug-22-2022, 08:40 PM
Last Post: deanhystad
  Link scripts from a different folder Extra 3 587 May-11-2022, 08:34 PM
Last Post: snippsat
  Dynamic File Name to a shared folder with open command in python sjcsvatt 9 1,792 Jan-07-2022, 04:55 PM
Last Post: bowlofred
  Code to check folder and sub folders for new file and alert fioranosnake 2 663 Jan-06-2022, 05:03 PM
Last Post: deanhystad
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 1,611 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  How to import file and function in another folder SriRajesh 1 990 Dec-18-2021, 08:35 AM
Last Post: Gribouillis
  Move file from one folder to another folder with timestamp added end of file shantanu97 0 1,588 Mar-22-2021, 10:59 AM
Last Post: shantanu97
  Writing to file in a specific folder evapa8f 5 2,178 Nov-13-2020, 10:10 PM
Last Post: deanhystad
  Reading SQL scripts from excel file and run it using python saravanatn 2 1,372 Aug-23-2020, 04:49 PM
Last Post: saravanatn
  Python Cut/Copy paste file from folder to another folder rdDrp 4 3,359 Aug-19-2020, 12:40 PM
Last Post: rdDrp

Forum Jump:

User Panel Messages

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