Using virtualenv in Pycharm as a Django IDE

Please help me with this. I do this on Fedora 16.

My virtual environment: /home/username/Desktop/.pythonenv

Now pay attention to the point. Since this is a hidden directory, I had to create a symbolic link to make Pycharm in the "enter" directory.

sudo ln -s /home/yeukhon/Desktop/.pythonenv /home/yeukhon/Desktop/sypythonenv 

Now I can use this virtual environment. However, two problems arose, and I am not sure that the first is related to the second.

a. Missing GTK and GST

Here are two screenshots. There is no GTK and GST in virtual vython ... I have no idea why.

System pythonVirtualenv

B. Django is not importable in this environment

I tried to run a Django project under virtualenv (project1), but I cannot. I can run the same project through Terminal.

 [ yeukhon@localhost ~]$ cd Desktop/djangoapp/project1 [ yeukhon@localhost mysite]$ source /home/yeukhon/Desktop/.pythonenv/project1/bin/activate (project1)[ yeukhon@localhost mysite]$ python2.7 manage.py runserver # I had to use python2.7 instead of python. That the only problem with terminal here. 

Question

  • How to make it work in Pycharm using my virtual Python interpreter?

  • Does No. 1 have anything in common with No. 2?

  • How to make GTK and GST appear in my virtualenv?

Thank you for your time.

+6
source share
1 answer

Firstly, there is no need to create a symbolic link, since the add interpreter dialog has a "show hidden files and directories" button, and you can also manually enter the path.

Every virtualenv, starting with version 1.7, is a default sandbox. This means that you must explicitly pass ENS -system-site-packages if you want to automatically include system libraries (before 1.7, you had to pass the no-site-packages option if you want to isolate env)

So, I assume that you just did not install the libraries that you lack in your virtualenv. Check the pipette freezing output after activating your virtual one. If these libraries are missing, just install them using pip:

pip install django

Now that you are using non-standard python for your virtual servers, make sure that you are not using the system alone. You can also call it directly using the one located in the / bin directory of your virtual server.

+4
source

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


All Articles