0

I need to create a simple library that will work in that way:

  1. I run python command prompt interpreter from Windows Start
  2. Write import <a name of library>
  3. Then write m_relation(<arguments>)
  4. Interpreter shows a result of what I need

I already have written down the code I need.

user302113
  • 13
  • 2
  • if you have the code, then what's the problem? You wouldn't be asking this question if everything was done, so where are you stumbling, and what code do you have that isn't working? – Silvio Mayolo Mar 23 '22 at 20:24
  • Code is working. I want to run it from command prompt via ```import```. Just like when you open command prompt and write ```>>> from math import factorial``` and then ```>>> factorial(10)``` – user302113 Mar 23 '22 at 20:32
  • Does this answer your question? [How to write a Python module/package?](https://stackoverflow.com/questions/15746675/how-to-write-a-python-module-package) – Carlos Horn Mar 23 '22 at 21:10

1 Answers1

0

firstly you can make a folder for your package in this path:

C:\Users\youruser\AppData\Local\Programs\Python\Python310\Lib\site-packages\

for example new_folder,

then you make or paste your library in this path,

after that you should make a setup.py file in this folder that contain this sample code:

from setuptools import setup

setup(
    name='My First Setup File',
    version='1.0',
    scripts=['your_file.py'],
)

then you open cmd in this path and run :

python setup.py install

eventually you can use this library from cmd.

Mohammad
  • 26
  • 5