Skip to content

Development

bondlegend4 edited this page Sep 14, 2024 · 4 revisions

To set up a Python virtual environment in a folder called openplc and name it test_env, follow these steps:

  1. Navigate to the openplc folder: Open your terminal or command prompt and navigate to the directory where you want to create the openplc folder.

    mkdir openplc
    cd openplc
  2. Create the virtual environment: Use Python’s venv module to create a virtual environment named test_env.

    python -m venv env
  3. Activate the virtual environment:

    • On Windows:

      env\Scripts\activate
    • On macOS/Linux:

      source ./env/bin/activate

bin/activate ```

  1. Verify that the environment is active: You can check if the virtual environment is activated by running:

    which python  # macOS/Linux
    where python  # Windows

    The output should point to the test_env directory.

Now you have successfully set up and activated a Python environment called test_env inside the openplc folder. You can install packages and develop your project within this isolated environment.

To deactivate (disable) a Python virtual environment, follow these steps based on your operating system: Simply run the following command in your terminal or command prompt:

deactivate

After running deactivate, your terminal will return to its normal state, and the virtual environment will no longer be active. You can now work outside of the test_env environment or activate a different one if needed.

Clone this wiki locally