#How I can send my python file to my friends?
6 messages · Page 1 of 1 (latest)
seems like it requires them to download the modules
Recommendation use virtual environments for your python projects.
Run in terminal: pip freeze
Copy the pip packages listed for your project into a *.txt file. E.g requirements.txt
Send the project to your friends with requirements.txt file
Ensure they are in the same directory as the project
If they have virtual environments tell them to switch in to them
Their terminals run: pip install -r requiremrnts.txt
All depedencies for the project should be installed and they can run it
What did you try in order to create an exe?
I did pyinstaller main.py --onefile -w
I fixed the problem, turns out they didn't have the libraries installed, so I made a script called install that installs every library automatically for them, they have to run it before starting. Here is the script:
import subprocess
import sys
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
# List of the libraries needed
dependencies = [
'pyautogui',
'pyautoit',
'keyboard',
'pynput',
'tk',
'requests',
'pygetwindow',
'numpy',
'pillow',
'multiprocessing',
'ctypes',
'webbrowser',
'configparser',
]
if __name__ == "__main__":
for package in dependencies:
try:
__import__(package)
except ImportError:
install(package)