-3

Suppose you wrote a python code which does certain operations (taking in excel data, perform analysis, giving out a excel data with graphs). You can do it because you have Python installed on your laptop. But how does your colleague work with the same code, if he want to use it?

Rohit Nirmal
  • 47
  • 1
  • 8
  • 1
    Does this answer your question? [How can I convert a .py to .exe for Python?](https://stackoverflow.com/questions/41570359/how-can-i-convert-a-py-to-exe-for-python) – Random Davis Aug 24 '22 at 15:19
  • 1
    You can't just farm rep points by creating near duplicate versions of existing questions and answering them – Random Davis Aug 24 '22 at 15:20

1 Answers1

-4

Step 1: Save the file, which you want make as an executable as filename.py in directory C:\Users\yourname

Step 2: Create an environment using command prompt so that the executable file can be made within the environment

C:\Users\yourname> mkdir Envirornments

Step 3: Go to the environment by typing following in command prompt: C:\Users\yourname> cd Environments Next thing will appear: C:\Users\yourname\Environments

Step 4: Create a new project environment, type following: C:\Users\yourname\Environments>virtualenv project2_env

Step 5: Give project a name into the environment, type following: C:\Users\yourname\Environments>cd project2_env

Step 6: Activate the project, type following: C:\Users\yourname\Environments\project2_env>Scripts\activate

Step 7: Install required packages for your python file, including pyinstaller:

(project2_env)C:\Users\yourname\Environments\project2_env>pip install package1

(project2_env)C:\Users\yourname\Environments\project2_env>pip install package2

(project2_env)C:\Users\yourname\Environments\project2_env>pip install package3

(project2_env)C:\Users\yourname\Environments\project2_env>pip install pyinstaller

Step 8: Copy paste the python file from step 1 to the environments folder.

Step 9: Create the executable file, type following:

(project2_env)C:\Users\yourname\Environments\project2_env> pyinstaller — onefile -w filename.py

Anaconda will make an executable file with the filename in the folder 'dist'. The file has python image on it and usually the largest size within the folder. If you double click the file, it will start running.

Rohit Nirmal
  • 47
  • 1
  • 8