'Cannot setup a Python SDK' in PyCharm project using virtualenv after OS reinstallation

后端 未结 7 1475
天命终不由人
天命终不由人 2021-01-01 09:27

I re-installed windows and opened an existing Pycharm project and get the error \'SDK seems invalid\' in Settings > Project Interpreter.

The project interpreter path

7条回答
  •  时光说笑
    2021-01-01 10:01

    Well, i'm pritty new to Python, and I did too had a re-install of my os after a crash

    Old setup: In the old system setup I used python 3.7.4. I made al my (practice)projects with that, and each project had a venv/scripts/python3.7.exe in it.... my undertanding is/was that all the files in these virtual environment where 'stand alone', so sufficient to run a python 3.7.4 for that specific projec files, and not depending on files of the home-python-dir. The install-directory of python was c:\Program Files (x86)\python 37-32

    Each project had a file [project-path]/venv/pyvenv.cfg, and in this file there was the line home = C:\Program Files (x86)\Python37-32

    then - my system crashed - reinstalled windows 10, and downloaded again python, but this time python 3.8, and it installed in C:\Program Files (x86)\Python38-32

    New setup: So, after some hairs lost - I also installed the old python version 3.7.4 in the specific path stated in the pyenv.cfg file (C:\Program Files (x86)\Python37-32). So, i had 2 python versions installed on my new system, one in .../python38-32 and one in .../python37-32

    And that worked, so when I selected in 'add interpreter/existing interpreter' and pointed to the [project]/venv/python3.7.exe it worked like a charm.

    So, apearantly there are files in each version-specific home-directory that pycharm/python needs - i was under the impression that the files in the .venv directory would be all it needed....

提交回复
热议问题