Environment change after restart

Answered

Hello,

Im having problems with python environments. I have created a virtual environment called virtual_environment and created a project within it. I imported Scrapy module inside this environment and everything worked well until I restarted IntelliJ IDEA. After restarting it the environment has changed. I can see from the Terminal that I am not using (virtual_environment) anymore and when running the same .py file that worked allright before restart, I see that the Scrapy module could not be imported (it is installed only in virtual environment, not in base).

I checked my project setting and I see that the default and currently used virtual envirinment is the one I need (virtual_environment), however based by the Terminal and fact that it does not recognize Scrapy commands anymore, it is clear that Im actually connected to base environment again. How to prevent such switch and how to switch back again to virtual_environment?

0
1 comment

It's definitely not recommended to store your project inside the virtual environment, though I can't see it on the screenshot you provided. It's ok to store virtualenv inside the project, but not the other way around.

Also, the import statement seems to be resolved so the correct environment is used by PyCharm.

Make sure File | Settings | Tools | Terminal | Activate virtualenv is enabled.

0

Please sign in to leave a comment.