1

I'm trying to run a python program with pycharm and I have this line of code:

for i, o in enumerate(outputs):
    f.write(f'#Output{i + 1}\t{o}\n')

The IDE marks the f inside the write function stating this error: "Python version 3 does not support a 'F' prefix".

Can anyone help?

I also have a problem that for some reason numpy package install does not succeed. Maybe that has any connection?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Dan798
  • 19
  • 4
  • 5
    the ide said so, but is there any error when you try running this code? – LTBS46 Dec 12 '21 at 19:51
  • 4
    what version of python3? f string only appeared from 3.6 – James Lin Dec 12 '21 at 19:51
  • I'm not sure so that must be it. anyone has a guide of how to change version in pycharm? – Dan798 Dec 12 '21 at 19:53
  • Look for the Python interpreter settings in Pycharm Preference – James Lin Dec 12 '21 at 19:54
  • Did you try googling the error message? I found some existing posts like [Wrong Python version in PyCharm's inspections](/q/49820407/4518341), [Setting the project interpreter in PyCharm to Python 3.7 causes spurious code incompatibility messages about Python 3.5](/q/52636098/4518341), and [How do I stop pycharm from complaining about F string in python 2.7, Im using python 3](https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000419930). I don't use PyCharm so I don't know if any of them solve the problem, but they should at least give you an idea of where to look. – wjandrea Dec 12 '21 at 21:27

0 Answers0