Why do I get an 'SDK seems invalid' error

2019-02-21 08:20发布

enter image description here

I try to set up project interpteter Python 3.5 in Pycharm and get an SDK error?

Any solution to fix it?

标签: pycharm
7条回答
贪生不怕死
2楼-- · 2019-02-21 08:58

I just had this error and got around it, and long-story-short I think it may have had to do with my PATH / PY_HOME / PYTHONPATH environment variables pointing to a different version of Python. Here's what I did:

Background:

  • In my case, I was trying to get a Python 2.7 venv running on a laptop where I'd previously been working with Python 3.
  • I'm using Windows 7.

Solution:

  1. Hit the Windows key to pop up the Start menu.
  2. Type out 'path' and hit Enter.
  3. The 'Environment Variables' window should appear.
    • There should be two sections of the window:
      1. One should say, "User variables for your_user_name".
      2. The other should say "System variables".
  4. In both sections of the window, look for and edit (if they exist) the PATH, PYTHONPATH, and PY_HOME environment variables.
    1. I removed any references to Python 3.
    2. I set the PY_HOME variable to C:\Python27 (or whatever the path is to the Python installation you're trying to get working in PyCharm.)
  5. I also deleted my installation of Python27 and reinstalled it, but I'm not sure that that was necessary.
  6. Restart PyCharm.
查看更多
戒情不戒烟
3楼-- · 2019-02-21 08:58

A fix for this issue, is tell to the global var named-> LD_LIBRARY_PATH to include the new python libraries compiled. Let's assume that you have just download python, extracted it & installed; assume that you have downloaded the 3.6.4 version

For include the library, you have to edit your .bashrc file. (This file is quite interesting, have a look ;) ). This file is an "hidden file" placed in your home: nano ~/.bashrc is a quite easy text editor. Go at the end of the file and append this command, replacing your path of new python export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/whoami/Downloads/Python-3.6.4

CTRL+X for save file.

For load the new file:

source ~/.bashrc

查看更多
不美不萌又怎样
4楼-- · 2019-02-21 09:01

I just ran into the same problem with Python 3.6 (which I wanted to use) and Python 3.7 also installed in my computer. My solution was just to remove reference to Python 3.7 from System PATH.

So my PATH is currently set:

C:\Program Files\Python36\Scripts\
C:\Program Files\Python36\

That's all, hope it helps.

查看更多
劫难
5楼-- · 2019-02-21 09:07

I got the same problem on windows 10, and got the solution.

PyCharm_Python_error.png

Root cause: - Python cannot be launched due to no python27.dll.

Solution: - Install python or put python27.dll in PATH

Thanks.

查看更多
Ridiculous、
6楼-- · 2019-02-21 09:12

Operating system: Windows 10 / cygwin

Desired Python: 2.7.14

Error: "SDK seems invalid"

My fix:

  1. Remove Python 64 bit version
    1. Install Python 32 bit version
    2. using the windows environment variable dialog set PY_HOME={somedrive}\{somepath}\Python27
      PYTHONPATH={somedrive}\{somepath}\Python27

note: I guess it works since the errors I see are python generated eg "Traceback (most recent call last): File ..."

查看更多
姐就是有狂的资本
7楼-- · 2019-02-21 09:13

did you move the whole project after you open it with pycharm? if so, just remove the .idea/* (run rm -r .idea under you project)

This problem is caused by: pycharm will create a .idea file under the project after the first time you import the project. SO the path in there will remain the old one after you moved the project. Thus the pycharm will keep trying to import 'old_path/venv/bin/activate' which is kept in .idea/*

查看更多
登录 后发表回答