Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directing PyCharm to Python 3.3 interpreter?

I'm not sure why I'm having so much trouble with this. I'm on OS X 10.7, and I installed Python with default settings and ran the .command file included.

I just want to get PyCharm working with Python 3.3, but I can't seem to find a working interpreter. The only one I can find loads instantly (gives 'distribute' and 'setuptools' packages) and gives me 'some skeletons failed to generate' errors. If I choose one of the 2.7 interpreters it loads for a while but I still get a similar error. I also get some issue with Python packaging tools not being found (usually it's 'pip').

I've searched for a long time but can't find a solution.

like image 634
Adam Avatar asked Dec 21 '12 10:12

Adam


People also ask

How do I change the default interpreter in Python PyCharm?

Change the Python interpreter in the project settingsPress Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. Expand the list of the available interpreters and click the Show All link. Select the target interpreter.

How do I use Python 3.7 instead of 3.8 in PyCharm?

In PyCharm, go to 'File' -> 'Settings' -> 'Project: <...>' -> 'Project Interpreter', and select 'Python 3.7' in the 'Project Interpreter' dropdown.


2 Answers

PyCharm detects Python 3.3 path automatically for the Python installed from http://python.org mpkg installer:

Path

/Library/Frameworks/Python.framework/Versions/3.3/bin/python3

Once you add this interpreter to PyCharm, install the package management tools (click on the Install 'distribute', then click on Install 'pip'):

pip

Upgrade pip to the latest version using the Upgrade button (distribute upgrade will fail).

Now you can install packages with the Install button, for example Django can be installed from the Interpreters dialog in PyCharm:

Django

If you have problems with code completion, try File | Invalidate Caches, restart PyCharm and wait until indexing is finished. For me it worked fine out of the box:

code completion works

like image 93
CrazyCoder Avatar answered Oct 05 '22 03:10

CrazyCoder


Python 3.3 now uses a new virtualenv mechanism called venv.

You can create one of these environments using:

pyvenv myprojectname

PyCharm 3.0 does not handle these correctly. The old virtualenv system copied python binaries into the environment, while venv creates symbolic links to the python3.3 binary instead. PyCharm tries to resolve all these symbolic links, until it finds a real file. This results in it ignoring your virtual environment and using the global environment instead.

To work around this bug, you can copy the python3.3 binary into your environment's bin folder and then add this as the project's interpreter in PyCharm.

like image 28
konrad Avatar answered Oct 05 '22 01:10

konrad