Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
147 views
in Technique[技术] by (71.8m points)

python - PyCharm does not recognize the interpreter it just created

Problem Statement

My PyCharm project does not recognize any Virtualenv project interpreter, including ones it successfully creates.

Steps Taken to Produce Error

  1. I opened PyCharm to the Welcome to PyCharm window.

  2. I clicked Get from Version Control. I cloned a private repo from my GitHub into my local system. I confirmed that all files from the repo were present.

  3. I opened the Add Python Interpreter window via File -> Settings -> Project: myProject -> Project Interpreter -> (gear button) -> "Add...".

  4. I selected the Virtualenv Environment option and the New environment radio button. I confirmed that the target Location (...myProjectvenv) did not yet exist. I selected Python 3.7 as my base interpreter, an installation which I have used without issue in other projects. I left both Inherit global site-packages and Make available to all projects unchecked.

  5. PyCharm successfully created the Virtualenv. I confirmed this in both PyCharm's Project tab and Windows Explorer. Double-clicking ...myProjectvenvScriptspython.exe launched a Python 3.7 shell as expected.

However, PyCharm's infobar at the bottom of the main window said <No interpreter>. The Project Interpreter settings menu also said <No interpreter>, and upon expanding the interpreter list dropdown, the interpreter which PyCharm had just successfully created for myProject was not listed.

Note

After taking the above steps, the newly-created Virtualenv is listed as an option under the Existing Interpreter radio button. However, selecting this option does nothing; the Project Interpreter window still says <No interpreter>.

Failed Remedies

  • Closing and Reopening PyCharm.
  • Choosing the Existing Interpreter radio button and targeting myProjectvenvScriptspython.exe.
  • Choosing the Existing Interpreter radio button and targeting the python.exe in a different project's Virtualenv.
  • Restarting my computer then Existing Interpreter -> myProjectvenvScriptspython.exe.
  • Creating a second Virtualenv (myProjectvenv-2).
  • Deleting all existing Virtualenvs, then creating a new one in myProjectvenv.

Leads

Creating a new, separate project (myProject_2) using the exact same steps as above does NOT replicate the error; a new Virtualenv is successfully created and recognized. This error is unique to myProject.

Regardless, I'm going to leave this question up. I want to understand what's going wrong here.

[Project Directory Structure]
myProject
    assets
        css
        images
        js
    MyProject
    courses
        migrations
        templates
            courses
        templatetags
    templates
    users
        migrations
        templates
            users
        templatetags
    venv


[Info]
Microsoft Windows 10 Pro
PyCharm 2019.3.3
Python 3.7.7
question from:https://stackoverflow.com/questions/65909088/pycharm-does-not-recognize-the-interpreter-it-just-created

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...