Python Forum
How to run an exe file in the Scripts folder using py.exe? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to run an exe file in the Scripts folder using py.exe? (/thread-34654.html)



How to run an exe file in the Scripts folder using py.exe? - quazirfan - Aug-18-2021

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?


RE: How to run an exe file in the Scripts folder using py.exe? - snippsat - Aug-18-2021

(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.



RE: How to run an exe file in the Scripts folder using py.exe? - quazirfan - Sep-08-2021

(jup_env) G:\div_code\jup_env
λ jupyter lab
Thanks this solves my problem.