Import error when importing openzeppelin contracts

:1234: Code to reproduce

pragma solidity = 0.5.16;

import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract Token1 is ERC20Detailed,ERC20{
    constructor() ERC20Detailed('Token 1','TK1',18) public{}
}

:computer: Environment

I am using solidity version 0.5.16. I have installed openzeppelin version 2.5.1. The error says that the openzeppelin contracts cant be imported. Later I found that it was because of the solidity version issue.

When I changed the solidity version this error disappears and everything is working well. But since I am using some other smart contracts written in solidity version 0.5.16, I cant change the version now.

What are the options I have to get this code to work. I am using Truffle.

Thanks for the help

Hi, welcome! :wave:

if you want to use different compiler versions, I think you can use this tool: solc-select