Pycharm insoluble link in virtualenv

When I started a new project in Pycharm using a virtual environment, I received an unauthorized help warning message.

enter image description here

But I installed django in my virtual environment, and this code works correctly.

How can i fix this? I am using PyCharm 4.5.2 Pro

+7
source share
5 answers

Open your project in Pycharm and complete the step:

click on the file (above)> settings> project interpreter> add local> select virtualenv

OR 

Make sure your project is the root directory, make it the root directory.

+5
source

In the end, I came across a method that worked for me, but I don't know what the problem is.

First I created virtualenv with PyCharm in the interpreter options. Annoyed that I had this problem, I deleted it and simply created virtualenv using the virtualenv command, but the problem remained.

Then I returned to the interpreter selector and selected "add local". I went to the python binary in the / bin folder of virtualenv I created and selected it. After that, unresolved links were fixed.

+3
source

I think your problem is similar to mine. I tested import matplotlib in the python shell and it works, but in Pycharm it shows an error. This is because Pycharm does not know the path of the site packages.

To fix this, you can do one of the following:

  • Add the path to the site packages (for me C: \ Program Files \ Python 3.5 \ lib \ site-packages) in PATH.

  • Go to File -> Preferences -> Project Interpreter, then select the real Python path instead of the vein path. enter image description here

  • In your code add the following:

,

 import sys sys.path.append(r"C:\Program Files\Python 3.5\lib\site-packages") import matplotlib.pyplot as plt 

I think this will help you :)

+1
source

Check the project root directory. Maybe the problem is in it.

And did you create virtualenv manually or through PyCharm?

0
source

File> Settings> Project> Project Structure

File> Settings> Project> Project Structure Double-click the folder link in the Content Root section and click OK.

0
source

All Articles