Python Forum

Full Version: Installing mailjet_rest for Python 3 while Python 2 is installed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to convert my python script from version 2 to 3. I need mailjet_rest but I cannot figure out how to install it for version 3. When I run pip3 to install it, it tells me it is already installed for version 2. How can I install mailjet_rest so python 3 can find it and keep it for version 2 as well? TIA.
To install mailjet_rest for Python 3 while keeping it for Python 2, follow these steps:

1. Check your Python 3 version and pip
Run the following to ensure you’re using Python 3’s pip:
`
python3 -m pip --version
`

2. Install mailjet_rest specifically for Python 3
`
python3 -m pip install mailjet_rest
`

3. Verify installation
After installation, check if Python 3 can find the package:
`
python3 -c "import mailjet_rest; print(mailjet_rest.__version__)"
`

4. Use a Virtual Environment (Recommended)
If you need both versions without conflicts, create a virtual environment for Python 3:
`
python3 -m venv myenv
source myenv/bin/activate # On Windows use: myenv\Scripts\activate
pip install mailjet_rest
`

This keeps dependencies isolated without affecting system-wide Python 2 installations.