Search code examples
pythonpycharmpython-modulepythoninterpreter

Distributing Pycharm projects with Modules installed in Interpreter without receivers/classmates needing to install said modules


I have installed the pyodbc, and numpy in an interpreter for the project as shown from my home computer

Interpreter in Project.

I tried zipping the pycharm project in hopes that I could run it with a different computer with pycharm (without needing to install the module[since the school proxy blocks pycharm access to internet]).

I wonder if it is possible. I tried it with my friend, as I asked him to run it with the interpreter from my zip folder \venv\scripts\python.exe. He sent me this error

Error Message.

Note: I'm using python 3.7, idk if he just accidentally selected 2.7.

My question is, Is there a way to distribute my project without receivers/classmates needing to download the package into their pycharm provided that I have the modules installed in the interpreter as show in this directory

Directory of Interpreter


Solution

  • If you package a virtual environment along with your code (your venv folder), then the recipient only needs to select the environment upon receiving it and opening the project in PyCharm. Once the project is open, go to Settings -> Project: ... -> Project Interpreter -> Add -> Add and select the folder containing the virtual environment under the 'Existing Environment' option.

    PyCharm Add Python Interpreter