Using spyder with virtualenv

I am new to Python and hug some basic concepts. I come from PHP background. The following is the definition / breakdown of the problem I am facing:

I installed anaconda , which had many libraries and tools on my system. This is a kind of "python master environment"

Then I created and downloaded a virtualenv . In this virtualenv, I downloaded several packages that I liked as pip install simplekml , pip install ipython

Now I opened the open spyder , and in the iPython console I tried import simplekml , and this gave me an import error. I read about this problem on the Internet and he said that in spyder I need to point to python in my virtualenv (using tools> preferences> python interpreter), or should I make pip install spyder from my virtualenv and use this version.

I tried both. I installed spyder in my virtualenv and then in the iPython console when I import simplekml received an error:

 ModuleNotFoundError: No module named 'simplekml' 

If I go to the terminal and open iPython and type the same thing, then it works fine. How can I load this terminal in spyder?

I struggled with this watch, so any help you provide is greatly appreciated!

+5
source share
1 answer

Based on what @ carlos-cordoba said in his comment. If you installed anaconda, I suggest you create an anaconda environment like this:

 conda create --name pyflakes spyder simplekml ipython 

This will create a pyflakes environment with spyder, simpleklm and ipython installed.

Then you just need to activate the environment using source activate pyflakes or activate pyflakes if you are on Windows and running spyder from there.

For more information on anaconda environments, see the documentation .

EDIT: add a virtualenv example.

For virtualenv user, this should work:

 $ pip install virtualenv $ cd my_project_folder $ virtualenv my_project $ source my_project/bin/activate $ pip install spyder simpleklm ipython 

A source

0
source

Source: https://habr.com/ru/post/1268590/


All Articles