Learn to Code via Tutorials on Repl.it!

← Back to all posts
Python Custom Packages
dObbOb11

Python Custom Packages

If you have created your own custom python package and wish to use it in Replit there are two options to add it :

PyPI Method

This is relatively simple assuming you know how to use PyPI
you can upload your project to PyPI and then load up your repl you wish to use the package in: eg. Python_Repl-:).
once in the repl you can use the shell command: pip install <package name>

sys.path Method

You can use the sys.path method in python to see what directories python searches for packages.
Once you know what directories to use you can use shell command to add it to PATH.

How to do it in python:

Import the sys module

then list all of the included directories

in Replit this should output something similar to the following:

the site-packages directory is were the 3rd-party packages are stored so we will use that one.
Replit only shows files things in the ~/<repl-name> directory, so to move our package we will need to use the shell.
to move files in bash you use the mv <folder/file-name> <destination-path> command. Type the following into the shell:

You should now be able to use the package in any repl.

Voters
93874153
abba1360
sar2
TimTimoroo
Dix2003
LukeBryan1
jonatewilliams
ANDRES-JESUSJE1
AqeelAlhlayl
JasonLI47
Comments
hotnewtop
porachanok

/print

porachanok

/pa

aaravsinha002

thanks

ErnestRante

import sys

JeetVyas1

Cool work.

SuperWhiteFish

nice

Jxggerzz

..

ISpot

mv <176187.gif> <Screenshot>

TravisRaney1

/print (path)

Karthikshivadsh

blood python