Question

After I broke my Ubuntu precise with a Cython compilation I like to keep the system Python clean. I like to have 2.7.x & 3.4.x besides each other and used Pyenv to have a global default interpreter independent from the system python. Now I also want to define local interpreters on a per project basis, usually done with pyenv local. Unfortunately my favorite IDE PyCharm does only support pyenv global, the local .python-version files are obviously not recognized by PyCharm.

So I tried to use the pyenv global interpreter in PyCharm with ~/.pyenv/bin/python-local-exec which works but unfortunately is already deprecated. When I then tried to create a virtualenv from the pyenv Python 3 global interpreter, it throwed the follwing error:

The following command was executed:

virtualenv.py /home/barrios/code/so/venv

The error output of the command:

pyenv: `python-local-exec' is deprecated and will be removed in the next release.
       To upgrade: https://github.com/yyuu/pyenv/wiki/python-local-exec

Failed to import the site module
Traceback (most recent call last):
  File "/home/barrios/code/so/venv/lib/python3.4/site.py", line 67, in <module>
    import os
  File "/home/barrios/code/so/venv/lib/python3.4/os.py", line 634, in <module>
    from _collections_abc import MutableMapping
ImportError: No module named '_collections_abc'

Using base prefix '/home/barrios/.pyenv/versions/3.4.0b3'
New python executable in /home/barrios/code/so/venv/bin/python
ERROR: The executable /home/barrios/code/so/venv/bin/python is not functioning
ERROR: It thinks sys.prefix is '/home/barrios/.pyenv/bin' (should be '/home/barrios/code/so/venv')
ERROR: virtualenv is not compatible with this system or executable

As mentioned before, I don't want to install Python 3 into my Ubuntu system folders. Any ideas how to achieve that?

TNX a lot!

Was it helpful?

Solution

I'd suggest to use https://github.com/yyuu/pyenv-virtualenv to create virtualenv for a desired interpreter and then add it as a Python interpreter in PyCharm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top