The two-factor authentication code will be send to your trusted devices (iPhone, iPad, iPod Touch, Mac) and/or trusted phone number. If you do not have one of those with you to receive the code on, then you can’t sign in with two-factor authentication. If that could be circumvented, then it wouldn’t protect the account, now would it?
Two-factor authentication for Apple ID - Apple Support
Get a verification code and sign in with two-factor authentication - Apple Support
On what device are you trying to sign in?
What device do you (otherwise) have to receive codes on?