I’m trying to import:
from django.db import models
PyCharm underlines django.db
and complains: Unresolved reference 'django'
.
How do I get PyCharm to recognize Django?
alex
6,3319 gold badges50 silver badges103 bronze badges
asked Feb 9, 2017 at 19:53
2
I assume you’re using a virtualenv which is located in the same directory as other project files. Python should know exactly that path. So, it’s possibly that Pycharm is using the wrong Interpreter.
Go to Settings -> Project: -> Project Interpreter -> switch to the right path
In the interpreter packages, there should be Django package installed. If not, do it here/in terminal.
answered Apr 17, 2017 at 16:58
Mark root folder of project as ‘Sources root’, it works for me.
Content Root
answered Jan 22, 2019 at 11:24
Igor ZIgor Z
5515 silver badges7 bronze badges
4
Above answers are answered partially.
Problem Description: I’ve multiple versions of python installed and Django is installed in one of Python version. There are two issues
-
Issue 1: Pycharm has wrong python interpreter. For this the
Project Interpreter
has to be changed to Python version where Django is installed. Solution: Follow all steps. -
Issue 2: Django isn’t listed as package. For this we need make available the installed python packages in the Pycharm environment. Solution: Follow all steps except step 3.
Solution:
Peform following steps.
- In preference/settings go to
Project
>Project Interpreter
- On right hand side click on
settings icon
>Add Local
- Select correct Python version from
Base Interpreter
- Mark the checkbox against
Inherit global site-packages
andMake available to all projects
- Click
ok
Once this is done in Project Intepreter
you will be able to see Django
in the Package list.
answered Mar 17, 2018 at 6:11
1
If you create the project use python2.7, and in python2.7 path you installed the django, the project works normal. Then you switch the Project Interpreter to the python3.5, but this path did not install the django, then you will get this issue.
answered Aug 8, 2017 at 8:17
aircraftaircraft
23.1k24 gold badges87 silver badges161 bronze badges
I got this problem and it stopped my unit tests from running.
I found that PyCharm, during an upgrade, had set my Python Interpreter
to one which was in a virtual environment, which I do not use any more for this project. So I set it to my global Python environment in C:Python
and everything works like a charm.
I hope this will help someone.
LuFFy
8,33110 gold badges38 silver badges59 bronze badges
answered Mar 29, 2017 at 18:55
GrahamJGrahamJ
5184 silver badges15 bronze badges
1
if you have installed Django successfully before, in a different location from project location:
in pycharm go to the setting
>Project
>project interpreter
.
right side of the Project Interpreter, click on setting icon and choose add local
.
then in New Environment check these two checkbox:
- inherit global site-packages
- make available to all projects
then press Ok
and Apply
button and wait installing the interpreter to your project location.
LuFFy
8,33110 gold badges38 silver badges59 bronze badges
answered Dec 17, 2017 at 17:43
MiladMilad
832 silver badges8 bronze badges
You can make pyCharm recognize it by setting it to use your virtualenv setup that I assume you had it already for the project
STEP 1: open preferences PyCharm > Preferences
STEP 2: Search for interpreter
and on the right window, select your virtual environment to be used in Project Interpreter
STEP 3 (ADDITIONAL): adding your environment to the list if it didn’t show up
-
select show all interpreter, and then on the pop up window, click + icon on the bottom left
-
select radio button
Existing Environment
and select your virtual env, and then check «Make available for all project» if you use the env for other project, and click ok
STEP 4: On the preferences window, click apply or straight click the ok button. wait couple second and django variable should be available in your project
answered Dec 22, 2018 at 18:15
WindoWindo
1,4961 gold badge12 silver badges8 bronze badges
1
Menu
-> Invalidate Caches / Restart
-> Invalidate and Restrart
answered Sep 3, 2020 at 15:55
Leonid DashkoLeonid Dashko
3,4681 gold badge17 silver badges26 bronze badges
Add this site-packages works for me. (On 20191218, using the newest version of PyCharm ,and python3.7.5 )
answered Dec 18, 2019 at 6:35
MarsYoungMarsYoung
4511 gold badge4 silver badges13 bronze badges
1
I had this problem too. In fact, I faced with this problem because django
package had not been installed in Pycharm. Therefore, I went to this path and clicked on plus sign;then, I searched django
and installed it. It worked well.
file
>setting
>project
>project interpreter
LuFFy
8,33110 gold badges38 silver badges59 bronze badges
answered Jun 2, 2018 at 10:09
M_GhM_Gh
9223 gold badges14 silver badges36 bronze badges
I used virtualenv in my project and the following steps is works for me.
Settings -> Project:XXX -> Project Interpreter —> click the right
side icon next to project interpreter -> more -> select the virtualenv
interpreter
hope it can help someone
core114
5,70614 gold badges85 silver badges178 bronze badges
answered Oct 3, 2018 at 3:12
I fix this issue by changing «Project Structure».
Try to unmark parent folder as «Sources»
answered Jun 14, 2018 at 11:21
1
I have a directory structure
├── simulate.py
├── src
│ ├── networkAlgorithm.py
│ ├── ...
And I can access the network module with sys.path.insert()
.
import sys
import os.path
sys.path.insert(0, "./src")
from networkAlgorithm import *
However, pycharm complains that it cannot access the module. How can I teach pycham to resolve the reference?
asked Jan 20, 2014 at 14:44
prosseekprosseek
178k204 gold badges559 silver badges860 bronze badges
11
Manually adding it as you have done is indeed one way of doing this, but there is a simpler method, and that is by simply telling pycharm that you want to add the src
folder as a source root, and then adding the sources root to your python path.
This way, you don’t have to hard code things into your interpreter’s settings:
- Add
src
as a source content root:
-
Then make sure to add add sources to your
PYTHONPATH
under:Preferences ~ Build, Execution, Deployment ~ Console ~ Python Console
- Now imports will be resolved:
This way, you can add whatever you want as a source root, and things will simply work. If you unmarked it as a source root however, you will get an error:
After all this don’t forget to restart. In PyCharm menu select: File —> Invalidate Caches / Restart
answered Jan 20, 2014 at 18:59
Games BrainiacGames Brainiac
78.6k32 gold badges139 silver badges195 bronze badges
16
- check for
__init__.py
file insrc
folder - add the
src
folder as a source root - Then make sure to add sources to your
PYTHONPATH
(see above) - in PyCharm menu select: File —> Invalidate Caches —> Restart
answered Jan 10, 2017 at 23:23
4
If anyone is still looking at this, the accepted answer still works for PyCharm 2016.3 when I tried it. The UI might have changed, but the options are still the same.
ie. Right click on your root folder —> ‘Mark Directory As’ —> Source Root
answered Apr 16, 2017 at 3:36
AeroHilAeroHil
8778 silver badges5 bronze badges
5
After testing all workarounds, i suggest you to take a look at Settings -> Project -> project dependencies
and re-arrange them.
answered Dec 12, 2016 at 13:03
mehdimehdi
2092 silver badges4 bronze badges
3
answered Jan 20, 2014 at 17:18
prosseekprosseek
178k204 gold badges559 silver badges860 bronze badges
3
There are several reasons why this could be happening. Below are several steps that fixes the majority of those cases:
.idea caching issue
Some .idea
issue causing the IDE to show error while the code still runs correctly. Solution:
- close the project and quick PyCharm
- delete the
.idea
folder where the project is. note that it is a hidden folder and you might not be aware of its existence in your project directory. - start PyCharm and recreate the project
imports relative not to project folder
Relative imports while code root folder is not the same as the project folder. Solution:
- Find the folder that relative imports require in the project explorer
- right click and mark it as «Source Root»
Editor not marking init.py as Python but as Text
Which is the most illusive of all the cases. Here, for some reason, PyCharm considers all __init__.py
files not to be python files, and thus ignores them during code analysis. To fix this:
- Open PyCharm settings
- Navigate to Editor -> File Types
- Find Python and add
__init__.py
to the list of python files
or
- Find Text and delete
__init__.py
from the list of text files
answered Mar 19, 2021 at 0:46
OussOuss
2,5992 gold badges24 silver badges41 bronze badges
10
The project I cloned had a directory called modules
and was successfully using files from there in the code with import this as that
, but Pycharm was unable to jump to those code fragments because it did not recognise the imports.
Marking the module folder in the following settings section as source
solved the issue.
answered Sep 29, 2021 at 17:13
bombenbomben
5806 silver badges16 bronze badges
Generally, this is a missing package problem, just place the caret at the unresolved reference and press Alt+Enter
to reveal the options, then you should know how to solve it.
answered Mar 15, 2017 at 9:31
Ch_yCh_y
3361 gold badge4 silver badges16 bronze badges
1
Although all the answers are really helpful, there’s one tiny piece of information that should be explained explicitly:
- Essentially, a project with multiple hierarchical directories work as a package with some attributes.
- To import custom local created Classes, we need to navigate to the directory containing
.py
file and create an__init__.py
(empty) file there.
Why this helps is because this file is required to make Python treat the directory as containing packages. Cheers!
answered Dec 9, 2019 at 10:19
Install via PyCharm (works with Community Edition). Open up Settings > Project > Project Interpreter
then click the green + icon in the screenshot below. In the 2nd dialogue that opens, enter the package name and click the ‘Install Package’ button.
answered Feb 17, 2018 at 14:38
danday74danday74
49.9k48 gold badges222 silver badges270 bronze badges
After following the accepted answer, doing the following solved it for me:
File
→ Settings
→ Project <your directory/project>
→ Project Dependencies
Chose the directory/project where your file that has unresolved imports resides and check the box to tell Pycharm that that project depends on your other project.
My folder hierarcy is slightly different from the one in the question. Mine is like this
├── MyDirectory
│ └── simulate.py
├── src
│ ├── networkAlgorithm.py
│ ├── ...
Telling Pycharm that src depends on MyDirectory
solved the issue for me!
Neuron
4,8435 gold badges36 silver badges54 bronze badges
answered May 16, 2018 at 13:37
BenjaminBenjamin
3973 silver badges9 bronze badges
This worked for me: Top Menu -> File -> Invalidate Caches/Restart
answered Sep 4, 2019 at 17:34
- —> Right-click on the directory where your files are located in PyCharm
- Go to the —> Mark Directory as
- Select the —> Source Root
your problem will be solved
answered Jun 27, 2020 at 3:18
I was also using a virtual environment like Dan above, however I was able to add an interpreter in the existing environment, therefore not needing to inherit global site packages and therefore undo what a virtual environment is trying to achieve.
answered Aug 17, 2020 at 9:24
TabsTabs
212 bronze badges
Please check if you are using the right interpreter that you are supposed to. I was getting error «unresolved reference ‘django’ » to solve this I changed Project Interpreter (Changed Python 3 to Python 2.7) from project settings:
Select Project, go to File -> Settings -> Project: -> Project Interpreter -> Brows and Select correct version or Interpreter (e.g /usr/bin/python2.7).
answered Jun 26, 2016 at 8:28
kishs1991kishs1991
9194 gold badges10 silver badges16 bronze badges
In my case the problem was I was using Virtual environment
which didn’t have access to global site-packages. Thus, the interpreter was not aware of the newly installed packages.
To resolve the issue, just edit or recreate your virtual interpreter and tick the Inherit global site-packages
option.
answered Apr 13, 2019 at 12:03
DanDan
4533 silver badges12 bronze badges
1
Done in PyCharm 2019.3.1
Right-click on your src folder -> «Mark Directory as» -> Click-on «Excluded» and your src folder should be blue.
answered Apr 24, 2020 at 8:59
I tried everything here twice and even more. I finally solved it doing something I hadn’t seen anywhere online. If you go to Settings>Editor>File Types
there is an 'Ignore Files and folders
‘ line at the bottom. In my case, I was ignoring 'venv'
, which is what I always name my virtual environments. So I removed venv;
from the list of directories to ignore and VOILA!! I was FINALLY able to fix this problem. Literally all of my import problems were fixed for the project.
BTW, I had installed each and every package using PyCharm, and not through a terminal. (Meaning, by going to Settings>Interpreter...
). I had invalidated cache, changed ‘Source Root’, restarted PyCharm, refreshed my interpreters paths, changed interpreters, deleted my venv… I tried everything. This finally worked. Obviously there are multiple problems going on here with different people, so this may not work for you, but it’s definitely worth a shot if nothing else has worked, and easy to reverse if it doesn’t.
answered Jun 26, 2020 at 15:56
user2233949user2233949
1,98518 silver badges21 bronze badges
For my case :
Directory0
├── Directory1
│ └── file1.py
├── Directory2
│ ├── file2.py
Into file1, I have :
from Directory2 import file2
which trows an «unresolved reference Directory2».
I resolved it by:
- marking the parent directory Directory0 as «Source Root» like said above
AND
- putting my cursor on another line on the file where I had the error so that it takes my modification into account
It is silly but if I don’t do the second action, the error still appears and can make you think that you didn’t resolve the issue by marking the parent directory as Source Root.
answered Jan 25, 2021 at 22:01
PozinuxPozinux
8742 gold badges10 silver badges20 bronze badges
1
For me, adding virtualenv (venv
)’s site-packages path to the paths of the interpreter works.
Finally!
answered Jun 17, 2020 at 8:23
weamingweaming
5,0971 gold badge20 silver badges15 bronze badges
I had the same problem and also try so many suggestions but none of them worked, until I find this post (https://stackoverflow.com/a/62632870/16863617). Regardless his solution didn’t work for me, it helped me to came up with the idea to add _init.py_ into the —> Settings | Editor | File Types | Python | Registered patterns
ScreenShot
And the unresolved reference error is now solved.
answered Sep 9, 2021 at 23:55
just note if u have a problem with python interpreter not installing
packages, just change the permission for folder PycharmProjects
C:Users’username’PycharmProjects
to every one
answered May 4, 2022 at 2:47
1
This problem also appears if you use a dash within the Python filename, which therefore is strongly discouraged.
answered Sep 8, 2022 at 10:44
Greg HolstGreg Holst
8249 silver badges22 bronze badges
I encountered an import problem when installing aiogram. At the same time, the bot worked, but pyCharm highlighted the import in red and did not give hints. I’ve tried all of the above many times.As a result, the following helped me: I found the aiogram folder at the following path
cUsers…AppDataRoamingPythonPython310site-packages
and copied it to the folder
C:Program FilesPython310Libsite-packages
After that, I reset pyCharm and that’s it!
answered Oct 10, 2022 at 12:40
In my case, with Pycharm 2019.3, the problem was that I forgot to add the extension ‘.py’ to the file I wanted to import. Once added, the error went away without needing to invalides caches or any other step.
answered Dec 6, 2022 at 14:25
EstebanEsteban
712 silver badges5 bronze badges
Pycharm uses venv. In the venv’s console you should install the packages explicitly or go in settings -> project interpreter -> add interpreter -> inherit global site-packages
.
answered Dec 4, 2017 at 10:09
yunusyunus
2,2751 gold badge14 silver badges12 bronze badges
The easiest way to fix it is by doing the following in your pyCharm software:
Click on: File > Settings > (Project: your project name) > Project Interpreter >
then click on the «+» icon on the right side to search for the package you want and install it.
Enjoy coding !!!
answered Nov 22, 2019 at 18:08
2
In newer versions of pycharm u can do simply by right clicking on the directory or python package from which you want to import a file, then click on ‘Mark Directory As’ -> ‘Sources Root’
answered Sep 18, 2019 at 7:36
Shravan KumarShravan Kumar
2511 gold badge3 silver badges6 bronze badges
0
I have a directory structure
├── simulate.py
├── src
│ ├── networkAlgorithm.py
│ ├── ...
And I can access the network module with sys.path.insert()
.
import sys
import os.path
sys.path.insert(0, "./src")
from networkAlgorithm import *
However, pycharm complains that it cannot access the module. How can I teach pycham to resolve the reference?
asked Jan 20, 2014 at 14:44
prosseekprosseek
178k204 gold badges559 silver badges860 bronze badges
11
Manually adding it as you have done is indeed one way of doing this, but there is a simpler method, and that is by simply telling pycharm that you want to add the src
folder as a source root, and then adding the sources root to your python path.
This way, you don’t have to hard code things into your interpreter’s settings:
- Add
src
as a source content root:
-
Then make sure to add add sources to your
PYTHONPATH
under:Preferences ~ Build, Execution, Deployment ~ Console ~ Python Console
- Now imports will be resolved:
This way, you can add whatever you want as a source root, and things will simply work. If you unmarked it as a source root however, you will get an error:
After all this don’t forget to restart. In PyCharm menu select: File —> Invalidate Caches / Restart
answered Jan 20, 2014 at 18:59
Games BrainiacGames Brainiac
78.6k32 gold badges139 silver badges195 bronze badges
16
- check for
__init__.py
file insrc
folder - add the
src
folder as a source root - Then make sure to add sources to your
PYTHONPATH
(see above) - in PyCharm menu select: File —> Invalidate Caches —> Restart
answered Jan 10, 2017 at 23:23
4
If anyone is still looking at this, the accepted answer still works for PyCharm 2016.3 when I tried it. The UI might have changed, but the options are still the same.
ie. Right click on your root folder —> ‘Mark Directory As’ —> Source Root
answered Apr 16, 2017 at 3:36
AeroHilAeroHil
8778 silver badges5 bronze badges
5
After testing all workarounds, i suggest you to take a look at Settings -> Project -> project dependencies
and re-arrange them.
answered Dec 12, 2016 at 13:03
mehdimehdi
2092 silver badges4 bronze badges
3
answered Jan 20, 2014 at 17:18
prosseekprosseek
178k204 gold badges559 silver badges860 bronze badges
3
There are several reasons why this could be happening. Below are several steps that fixes the majority of those cases:
.idea caching issue
Some .idea
issue causing the IDE to show error while the code still runs correctly. Solution:
- close the project and quick PyCharm
- delete the
.idea
folder where the project is. note that it is a hidden folder and you might not be aware of its existence in your project directory. - start PyCharm and recreate the project
imports relative not to project folder
Relative imports while code root folder is not the same as the project folder. Solution:
- Find the folder that relative imports require in the project explorer
- right click and mark it as «Source Root»
Editor not marking init.py as Python but as Text
Which is the most illusive of all the cases. Here, for some reason, PyCharm considers all __init__.py
files not to be python files, and thus ignores them during code analysis. To fix this:
- Open PyCharm settings
- Navigate to Editor -> File Types
- Find Python and add
__init__.py
to the list of python files
or
- Find Text and delete
__init__.py
from the list of text files
answered Mar 19, 2021 at 0:46
OussOuss
2,5992 gold badges24 silver badges41 bronze badges
10
The project I cloned had a directory called modules
and was successfully using files from there in the code with import this as that
, but Pycharm was unable to jump to those code fragments because it did not recognise the imports.
Marking the module folder in the following settings section as source
solved the issue.
answered Sep 29, 2021 at 17:13
bombenbomben
5806 silver badges16 bronze badges
Generally, this is a missing package problem, just place the caret at the unresolved reference and press Alt+Enter
to reveal the options, then you should know how to solve it.
answered Mar 15, 2017 at 9:31
Ch_yCh_y
3361 gold badge4 silver badges16 bronze badges
1
Although all the answers are really helpful, there’s one tiny piece of information that should be explained explicitly:
- Essentially, a project with multiple hierarchical directories work as a package with some attributes.
- To import custom local created Classes, we need to navigate to the directory containing
.py
file and create an__init__.py
(empty) file there.
Why this helps is because this file is required to make Python treat the directory as containing packages. Cheers!
answered Dec 9, 2019 at 10:19
Install via PyCharm (works with Community Edition). Open up Settings > Project > Project Interpreter
then click the green + icon in the screenshot below. In the 2nd dialogue that opens, enter the package name and click the ‘Install Package’ button.
answered Feb 17, 2018 at 14:38
danday74danday74
49.9k48 gold badges222 silver badges270 bronze badges
After following the accepted answer, doing the following solved it for me:
File
→ Settings
→ Project <your directory/project>
→ Project Dependencies
Chose the directory/project where your file that has unresolved imports resides and check the box to tell Pycharm that that project depends on your other project.
My folder hierarcy is slightly different from the one in the question. Mine is like this
├── MyDirectory
│ └── simulate.py
├── src
│ ├── networkAlgorithm.py
│ ├── ...
Telling Pycharm that src depends on MyDirectory
solved the issue for me!
Neuron
4,8435 gold badges36 silver badges54 bronze badges
answered May 16, 2018 at 13:37
BenjaminBenjamin
3973 silver badges9 bronze badges
This worked for me: Top Menu -> File -> Invalidate Caches/Restart
answered Sep 4, 2019 at 17:34
- —> Right-click on the directory where your files are located in PyCharm
- Go to the —> Mark Directory as
- Select the —> Source Root
your problem will be solved
answered Jun 27, 2020 at 3:18
I was also using a virtual environment like Dan above, however I was able to add an interpreter in the existing environment, therefore not needing to inherit global site packages and therefore undo what a virtual environment is trying to achieve.
answered Aug 17, 2020 at 9:24
TabsTabs
212 bronze badges
Please check if you are using the right interpreter that you are supposed to. I was getting error «unresolved reference ‘django’ » to solve this I changed Project Interpreter (Changed Python 3 to Python 2.7) from project settings:
Select Project, go to File -> Settings -> Project: -> Project Interpreter -> Brows and Select correct version or Interpreter (e.g /usr/bin/python2.7).
answered Jun 26, 2016 at 8:28
kishs1991kishs1991
9194 gold badges10 silver badges16 bronze badges
In my case the problem was I was using Virtual environment
which didn’t have access to global site-packages. Thus, the interpreter was not aware of the newly installed packages.
To resolve the issue, just edit or recreate your virtual interpreter and tick the Inherit global site-packages
option.
answered Apr 13, 2019 at 12:03
DanDan
4533 silver badges12 bronze badges
1
Done in PyCharm 2019.3.1
Right-click on your src folder -> «Mark Directory as» -> Click-on «Excluded» and your src folder should be blue.
answered Apr 24, 2020 at 8:59
I tried everything here twice and even more. I finally solved it doing something I hadn’t seen anywhere online. If you go to Settings>Editor>File Types
there is an 'Ignore Files and folders
‘ line at the bottom. In my case, I was ignoring 'venv'
, which is what I always name my virtual environments. So I removed venv;
from the list of directories to ignore and VOILA!! I was FINALLY able to fix this problem. Literally all of my import problems were fixed for the project.
BTW, I had installed each and every package using PyCharm, and not through a terminal. (Meaning, by going to Settings>Interpreter...
). I had invalidated cache, changed ‘Source Root’, restarted PyCharm, refreshed my interpreters paths, changed interpreters, deleted my venv… I tried everything. This finally worked. Obviously there are multiple problems going on here with different people, so this may not work for you, but it’s definitely worth a shot if nothing else has worked, and easy to reverse if it doesn’t.
answered Jun 26, 2020 at 15:56
user2233949user2233949
1,98518 silver badges21 bronze badges
For my case :
Directory0
├── Directory1
│ └── file1.py
├── Directory2
│ ├── file2.py
Into file1, I have :
from Directory2 import file2
which trows an «unresolved reference Directory2».
I resolved it by:
- marking the parent directory Directory0 as «Source Root» like said above
AND
- putting my cursor on another line on the file where I had the error so that it takes my modification into account
It is silly but if I don’t do the second action, the error still appears and can make you think that you didn’t resolve the issue by marking the parent directory as Source Root.
answered Jan 25, 2021 at 22:01
PozinuxPozinux
8742 gold badges10 silver badges20 bronze badges
1
For me, adding virtualenv (venv
)’s site-packages path to the paths of the interpreter works.
Finally!
answered Jun 17, 2020 at 8:23
weamingweaming
5,0971 gold badge20 silver badges15 bronze badges
I had the same problem and also try so many suggestions but none of them worked, until I find this post (https://stackoverflow.com/a/62632870/16863617). Regardless his solution didn’t work for me, it helped me to came up with the idea to add _init.py_ into the —> Settings | Editor | File Types | Python | Registered patterns
ScreenShot
And the unresolved reference error is now solved.
answered Sep 9, 2021 at 23:55
just note if u have a problem with python interpreter not installing
packages, just change the permission for folder PycharmProjects
C:Users’username’PycharmProjects
to every one
answered May 4, 2022 at 2:47
1
This problem also appears if you use a dash within the Python filename, which therefore is strongly discouraged.
answered Sep 8, 2022 at 10:44
Greg HolstGreg Holst
8249 silver badges22 bronze badges
I encountered an import problem when installing aiogram. At the same time, the bot worked, but pyCharm highlighted the import in red and did not give hints. I’ve tried all of the above many times.As a result, the following helped me: I found the aiogram folder at the following path
cUsers…AppDataRoamingPythonPython310site-packages
and copied it to the folder
C:Program FilesPython310Libsite-packages
After that, I reset pyCharm and that’s it!
answered Oct 10, 2022 at 12:40
In my case, with Pycharm 2019.3, the problem was that I forgot to add the extension ‘.py’ to the file I wanted to import. Once added, the error went away without needing to invalides caches or any other step.
answered Dec 6, 2022 at 14:25
EstebanEsteban
712 silver badges5 bronze badges
Pycharm uses venv. In the venv’s console you should install the packages explicitly or go in settings -> project interpreter -> add interpreter -> inherit global site-packages
.
answered Dec 4, 2017 at 10:09
yunusyunus
2,2751 gold badge14 silver badges12 bronze badges
The easiest way to fix it is by doing the following in your pyCharm software:
Click on: File > Settings > (Project: your project name) > Project Interpreter >
then click on the «+» icon on the right side to search for the package you want and install it.
Enjoy coding !!!
answered Nov 22, 2019 at 18:08
2
In newer versions of pycharm u can do simply by right clicking on the directory or python package from which you want to import a file, then click on ‘Mark Directory As’ -> ‘Sources Root’
answered Sep 18, 2019 at 7:36
Shravan KumarShravan Kumar
2511 gold badge3 silver badges6 bronze badges
0
I’m trying to import:
from django.db import models
PyCharm underlines django.db
and complains: Unresolved reference 'django'
.
How do I get PyCharm to recognize Django?
I assume you’re using a virtualenv which is located in the same directory as other project files. Python should know exactly that path. So, it’s possibly that Pycharm is using the wrong Interpreter.
Go to Settings -> Project: -> Project Interpreter -> switch to the right path
In the interpreter packages, there should be Django package installed. If not, do it here/in terminal.
Mark root folder of project as ‘Sources root’, it works for me.
Content Root
Above answers are answered partially.
Problem Description: I’ve multiple versions of python installed and Django is installed in one of Python version. There are two issues
-
Issue 1: Pycharm has wrong python interpreter. For this the
Project Interpreter
has to be changed to Python version where Django is installed. Solution: Follow all steps. -
Issue 2: Django isn’t listed as package. For this we need make available the installed python packages in the Pycharm environment. Solution: Follow all steps except step 3.
Solution:
Peform following steps.
- In preference/settings go to
Project
>Project Interpreter
- On right hand side click on
settings icon
>Add Local
- Select correct Python version from
Base Interpreter
- Mark the checkbox against
Inherit global site-packages
andMake available to all projects
- Click
ok
Once this is done in Project Intepreter
you will be able to see Django
in the Package list.
If you create the project use python2.7, and in python2.7 path you installed the django, the project works normal. Then you switch the Project Interpreter to the python3.5, but this path did not install the django, then you will get this issue.
I got this problem and it stopped my unit tests from running.
I found that PyCharm, during an upgrade, had set my Python Interpreter
to one which was in a virtual environment, which I do not use any more for this project. So I set it to my global Python environment in C:Python
and everything works like a charm.
I hope this will help someone.
You can make pyCharm recognize it by setting it to use your virtualenv setup that I assume you had it already for the project
STEP 1: open preferences PyCharm > Preferences
STEP 2: Search for interpreter
and on the right window, select your virtual environment to be used in Project Interpreter
STEP 3 (ADDITIONAL): adding your environment to the list if it didn’t show up
-
select show all interpreter, and then on the pop up window, click + icon on the bottom left
-
select radio button
Existing Environment
and select your virtual env, and then check «Make available for all project» if you use the env for other project, and click ok
STEP 4: On the preferences window, click apply or straight click the ok button. wait couple second and django variable should be available in your project
if you have installed Django successfully before, in a different location from project location:
in pycharm go to the setting
>Project
>project interpreter
.
right side of the Project Interpreter, click on setting icon and choose add local
.
then in New Environment check these two checkbox:
- inherit global site-packages
- make available to all projects
then press Ok
and Apply
button and wait installing the interpreter to your project location.
Menu
-> Invalidate Caches / Restart
-> Invalidate and Restrart
Add this site-packages works for me. (On 20191218, using the newest version of PyCharm ,and python3.7.5 )
I had this problem too. In fact, I faced with this problem because django
package had not been installed in Pycharm. Therefore, I went to this path and clicked on plus sign;then, I searched django
and installed it. It worked well.
file
>setting
>project
>project interpreter
I used virtualenv in my project and the following steps is works for me.
Settings -> Project:XXX -> Project Interpreter —> click the right
side icon next to project interpreter -> more -> select the virtualenv
interpreter
hope it can help someone
I fix this issue by changing «Project Structure».
Try to unmark parent folder as «Sources»
Comments Section
You might have to set which python environment you’re using in pycharm. Are you using virtualenv?
Normally, selecting your interpreter from File -> Settings -> Project Interpreter should work. If not listed, add it.
please provide detailed information of your issue and how you have fix step by step
In newer versions the «Base Interpreter» is called «Virtualenv Environment»
That’s right. You should locate the python file in the
virutanenv
directory. Not the system python file.
Pycharm restart was helpful for me.
I had the proper virtualenv selected with django installed, and still my applications were showing as ‘unresolved references’. From
File>Settings>Project Structure
setting the project root folder as a «Source» resolved the issue. (As mentioned here)
Works for me… with variation for PyCharm 2019.1 … PyCharm / Preferences / Project :<mydir> / Project Structure … then mark your <myproject><myproject> folder as Sources
And mac vesion is Catalina 10.15.2 (19C57)
i can confirm this solved my problem on pycharm 2019.1
This solved my issue as well, thanks! I navigated by going to
Pycham > Preferences > My Project > Project Structure
on mac
Related Topics
python
python-3.x
django
pycharm
Mentions
Alex
Igor Z
Aircraft
Mars Young
Lu F Fy
Graham J
Milad
Ayush Vatsyayan
Leonid Dashko
Elisabeth Shevtsova
Windo
Melistraza
References
https://stackoverflow.com/questions/42145656/unresolved-reference-django-error-in-pycharm
Я пытаюсь импортировать:
from django.db import models
PyCharm подчеркивает django.db
и жалуется: Unresolved reference 'django'
.
Как мне заставить PyCharm узнать Django?
Ответ 1
Я предполагаю, что вы используете virtualenv, который находится в том же каталоге, что и другие файлы проекта. Python должен точно знать этот путь. Таким образом, возможно, что Pycharm использует неверный интерпретатор.
Перейдите в Настройки → Проект: → Переводчик проекта → переключиться на правильный путь
В пакетах интерпретатора должен быть установлен пакет Django. Если нет, сделайте это здесь/в терминале.
Ответ 2
Ответы частично отвечают частично.
Описание проблемы. У меня установлено несколько версий python, а Django — в одной из версий Python. Есть два вопроса
-
Проблема 1: У Pycharm есть неправильный интерпретатор python. Для этого
Project Interpreter
необходимо изменить на версию Python, где установлен Django. Решение. Следуйте всем шагам. -
Проблема 2: Django не указан как пакет. Для этого нам нужно сделать доступными установленные пакеты python в среде Pycharm. Решение. Следуйте всем шагам, кроме шага 3.
Решение:
Выполните следующие шаги.
- В настройках/настройках перейдите к
Project
>Project Interpreter
- В правой части нажмите
settings icon
>Add Local
- Выберите правильную версию Python из
Base Interpreter
- Отметьте флажок напротив
Inherit global site-packages
иMake available to all projects
- Нажмите
ok
Как только это будет сделано в Project Intepreter
, вы сможете увидеть Django
в списке пакетов.
Ответ 3
У меня возникла эта проблема, и она остановила мои модульные тесты.
Я обнаружил, что PyCharm во время обновления установил мой Python Interpreter
на тот, который находился в виртуальной среде, которую я больше не использую для этого проекта. Поэтому я установил его в моей глобальной среде Python в C:Python
и все работает как шарм.
Надеюсь, это кому-нибудь поможет.
Ответ 4
Если вы создаете проект, используйте python2.7, а в пути python2.7 вы установили django, проект работает нормально. Затем вы переключаете Project Interpreter на python3.5, но этот путь не установил django, тогда вы получите эту проблему.
Ответ 5
если вы успешно установили Django ранее, в другом месте, отличном от местоположения проекта: в pycharm перейдите к setting
> Project
> project interpreter
. В правой части окна «Интерпретатор проекта» щелкните значок настройки и выберите » add local
.
затем в Новой среде установите эти два флажка:
- наследовать глобальные пакеты сайтов
- сделать доступным для всех проектов
затем нажмите кнопку » Ok
и » Apply
и дождитесь установки переводчика в место вашего проекта.
Ответ 6
Вы можете сделать так, чтобы pyCharm распознал его, настроив его на использование вашей установки virtualenv, которая, как я полагаю, у вас уже была для проекта
ШАГ 1: открыть настройки PyCharm > Preferences
ШАГ 2. Найдите interpreter
и в правом окне выберите вашу виртуальную среду для использования в Project Interpreter
ШАГ 3 (ДОПОЛНИТЕЛЬНО): добавление вашей среды в список, если она не отображается
-
выберите Показать всех переводчиков, а затем во всплывающем окне нажмите значок + в левом нижнем углу
-
установите переключатель »
Existing Environment
выберите виртуальный env, а затем установите флажок «Сделать доступным для всех проектов», если вы используете env для другого проекта, и нажмите «ОК».
ШАГ 4: В окне настроек нажмите «Применить» или просто нажмите кнопку «ОК». подождите пару секунд и переменная django должна быть доступна в вашем проекте
Ответ 7
У меня тоже была эта пробема. Фактически я столкнулся с этой проблемой, потому что пакет django
не был установлен в Pycharm. Поэтому я пошел по этому пути и нажал на знак плюс, затем я искал django
и установил его. Это сработало хорошо.
file
> setting
> project
> project interpreter
Ответ 8
Я исправляю эту проблему, изменяя «Структуру проекта». Попробуйте снять отметку с родительской папки как «Источники»
Ответ 9
Я использовал virtualenv в своем проекте, и следующие шаги для меня работают.
Настройки → Проект: XXX → Интерпретатор проекта → щелкните значок справа рядом с переводчиком проекта → еще → выберите переводчика virtualenv
надеюсь, что это может помочь кому-то
Ответ 10
Пометить корневую папку проекта как ‘Sources root’, у меня это работает. Корень контента
Are you looking for an answer to the topic “python import could not be resolved“? We answer all your questions at the website barkmanoil.com in category: Newly updated financial and investment news for you. You will find the answer right below.
Keep Reading
How do I fix unresolved import in Python?
If you are working with Visual Studio Code and import any library, you will face this error: “unresolved import”. To resolve this error, In your workspace settings, you can set your Python path like the following. Then reload the VSCode, and it will fix that error.
What does unresolved import mean in Python?
“Unresolved Import” is an error message produced by VSCode, not Python itself. The message simply means that VSCode cannot detect the correct path for a Python module.
How to fix Import could not be resolved from source Pylance
How to fix Import could not be resolved from source Pylance
How to fix Import could not be resolved from source Pylance
Images related to the topicHow to fix Import could not be resolved from source Pylance
How install Numpy VSCode?
To install numpy, select pip from the dropdown for Python Environment, then type numpy and click on the “install numpy from PyPI” as shown below. Similarly search for scipy and install it using pip. If you get any errors in installing scipy, then download first anaconda from the following site.
How do I add Python interpreter to Visual Studio Code?
To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python. defaultInterpreterPath , which is in the Python extension section of User Settings, with the appropriate interpreter.
What is unresolved reference in Python?
Many a times what happens is that the plugin is not installed. e.g. If you are developing a django project and you do not have django plugin installed in pyCharm, it says error ‘unresolved reference’. Refer: https://www.jetbrains.com/pycharm/help/resolving-references.html. Follow this answer to receive notifications.
How do I fix unresolved imports in Django?
However, for every import I have states “unresolved import”. Even on default Django imports (i.e. from django. db import models).
…
What I did to resolve this issue:
- Go into the workspace folder (here workspaceRootFolder) and create a . env file.
- In this empty . …
- Add “python. …
- Restart Visual Studio Code.
Why is my import Numpy not working?
Python Import Numpy Not Working
Python import numpy is not working that means eithers the module is not installed or the module is corrupted. To fix the corrupted module, uninstall it first then reinstall it.
See some more details on the topic python import could not be resolved here:
Import could not be resolved/could not be … – Stack Overflow
1.Open Command Palette, then select the Python: Select Interpreter command. From the list, select the virtual environment in your project …
+ View Here
Import “[module]” could not be resolvedPylance … – GitHub
I am learning a Python book, so I created folder for each chapter to storage code. … Import “a” could not be resolved.
+ Read More Here
Import could not be resolved [Pylance] : r/vscode – Reddit
14 votes, 12 comments. I’m trying to use torch in a python script but even though it’s pip installed, pylance doesn’t recognize it…
+ View Here
‘Import “Path.to.own.script” could not be resolved Pylance …
Solution 1: · In VS Code press + <,> to open Settings. · Type in python.analysis.extraPaths · Select “Add Item” · Type in the path to your library /home/ …
+ View More Here
How do I find my Python path?
Is Python in your PATH ?
- In the command prompt, type python and press Enter . …
- In the Windows search bar, type in python.exe , but don’t click on it in the menu. …
- A window will open up with some files and folders: this should be where Python is installed. …
- From the main Windows menu, open the Control Panel:
How do you reload VSCode?
There are some ways to do so:
- Open the command palette ( Ctrl + Shift + P ) and execute the command: >Reload Window.
- Define a keybinding for the command (for example CTRL + F5 ) in keybindings.json : [ { “key”: “ctrl+f5”, “command”: “workbench.action.reloadWindow”, “when”: “editorTextFocus” } ]
How do I import a NumPy library into Python?
How to Install NumPy
- Installing NumPy. Step 1: Check Python Version. Step 2: Install Pip. Step 3: Install NumPy. Step 4: Verify NumPy Installation. Step 5: Import the NumPy Package.
- Upgrading NumPy.
What is import NumPy as NP?
The import numpy portion of the code tells Python to bring the NumPy library into your current environment. The as np portion of the code then tells Python to give NumPy the alias of np. This allows you to use NumPy functions by simply typing np.
SOLVED : Import “flask” could not be resolved from sourcePylance in Python
SOLVED : Import “flask” could not be resolved from sourcePylance in Python
SOLVED : Import “flask” could not be resolved from sourcePylance in Python
Images related to the topicSOLVED : Import “flask” could not be resolved from sourcePylance in Python
Does Python install pip?
PIP is automatically installed with Python 2.7. 9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
How do I use Microsoft Visual Studio for Python?
This tutorial guides you through the following steps:
- Step 0: Installation.
- Step 1: Create a Python project (this article)
- Step 2: Write and run code to see Visual Studio IntelliSense at work.
- Step 3: Create more code in the Interactive REPL window.
- Step 4: Run the completed program in the Visual Studio debugger.
How do I run Python code in Visual Studio terminal?
To run Python code:
- use shortcut Ctrl + Alt + N.
- or press F1 and then select/type Run Code,
- or right click the Text Editor and then click Run Code in the editor context menu.
- or click the Run Code button in the editor title menu.
- or click Run Code button in the context menu of file explorer.
How do I run a Python script in Visual Studio 2019?
Launch Visual Studio 2019 and in the start window, select Open at the bottom of the Get started column. Alternately, if you already have Visual Studio running, select the File > Open > Folder command instead. Navigate to the folder containing your Python code, then choose Select Folder.
What does it mean when an xref is unresolved?
Causes: The xref is nested and the parent file has changed. The drive letter where the xrefs are stored has changed. The actual xref file was deleted or moved.
How do I resolve import error in PyCharm?
Troubleshooting: Try installing/importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment. In case you are using a virtualenv/conda environment as your Project Interpreter in PyCharm, it is enough to activate that environment in the system terminal and then do the test.
What is the correct process to resolve references one correct answer?
References are resolved using the following steps: If a reference has a HintPath metadata and a file exists at that path (absolute or relative to the project), it will be used. If the name of the reference itself refers to a valid file (absolute or relative to the project), it will be used.
What is the requirement for Django installation and use?
Django is a Python web framework, thus requiring Python to be installed on your machine. To install Python on your machine go to https://python.org/download/, and download a Windows MSI installer for Python. Once downloaded, run the MSI installer and follow the on-screen instructions.
Where is settings JSON in VSCode?
You can open the settings. json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P). Once the file is open in an editor, delete everything between the two curly braces {} , save the file, and VS Code will go back to using the default values.
How do I access settings JSON VSCode?
vscode/settings. json (shortcut: Ctrl / Cmd + P and type “settings. json”). If that settings.
…
To open the User settings:
- Open the command palette (either with F1 or Ctrl + Shift + P )
- Type “open settings”
- You are presented with two options, choose Open Settings (JSON)
import ”pandas” could not be resolved from source pylance report missing module source | #code_gyani
import ”pandas” could not be resolved from source pylance report missing module source | #code_gyani
import ”pandas” could not be resolved from source pylance report missing module source | #code_gyani
Images related to the topicimport ”pandas” could not be resolved from source pylance report missing module source | #code_gyani
How do I fix numpy error?
This tutorial shares the exact steps you can use to troubleshoot this error.
- Step 1: pip install numpy. Since NumPy doesn’t come installed automatically with Python, you’ll need to install it yourself. …
- Step 2: Install pip. If you’re still getting an error, you may need to install pip. …
- Step 3: Check NumPy Version.
How do I install all Python libraries?
Install Python and libraries
- Install launcher for all users.
- Add Python to the PATH.
- Install pip (which allows Python to install other packages)
- Install tk/tcl and IDLE.
- Install the Python test suite.
- Install py launcher for all users.
- Associate files with Python.
- Create shortcuts for installed applications.
Related searches to python import could not be resolved
- vscode python import could not be resolved pylance
- Unresolved import python
- visual studio python import could not be resolved
- python venv import could not be resolved
- vscode python import could not be resolved
- python import could not be resolved same directory
- python import could not be resolvedpylance
- import keyboard could not be resolvedpylance
- Import scipy could not be resolved
- import could not be resolved pylance
- python local import could not be resolved
- import scipy could not be resolved
- python import requests could not be resolved
- Import numpy could not be resolved vscode
- import numpy could not be resolved vscode
- python import could not be resolved after pip install
- import flask could not be resolved from source
- Import could not be resolved Pylance
- Report missing imports
- import pandas could not be resolved from source vscode
- python import could not be resolved from source
- report missing imports
- vscode python import could not be resolved from source
- unresolved import python
- visual studio code python import could not be resolved pylance
- python import could not be resolved pylance
- import selenium could not be resolved python
- python visual studio code import could not be resolved
- Import flask” could not be resolved from source
- python import could not be resolved vscode
Information related to the topic python import could not be resolved
Here are the search results of the thread python import could not be resolved from Bing. You can read more if you want.
You have just come across an article on the topic python import could not be resolved. If you found this article useful, please share it. Thank you very much.
1 answer to this question.
Hello @kartik,
I assume you’re using a virtualenv which is located in the same directory as other project files. Python should know exactly that path. So, it’s possibly that Pycharm is using the wrong Interpreter.
Go to Settings -> Project: -> Project Interpreter -> switch to the right path
In the interpreter packages, there should be Django package installed. If not, do it here/in terminal.
Hope it helps!!
Thank you!!
answered
Jul 2, 2020
by
Niroj
• 82,840 points
Related Questions In Python
- All categories
-
ChatGPT
(4) -
Apache Kafka
(84) -
Apache Spark
(596) -
Azure
(131) -
Big Data Hadoop
(1,907) -
Blockchain
(1,673) -
C#
(141) -
C++
(271) -
Career Counselling
(1,060) -
Cloud Computing
(3,446) -
Cyber Security & Ethical Hacking
(147) -
Data Analytics
(1,266) -
Database
(855) -
Data Science
(75) -
DevOps & Agile
(3,575) -
Digital Marketing
(111) -
Events & Trending Topics
(28) -
IoT (Internet of Things)
(387) -
Java
(1,247) -
Kotlin
(8) -
Linux Administration
(389) -
Machine Learning
(337) -
MicroStrategy
(6) -
PMP
(423) -
Power BI
(516) -
Python
(3,188) -
RPA
(650) -
SalesForce
(92) -
Selenium
(1,569) -
Software Testing
(56) -
Tableau
(608) -
Talend
(73) -
TypeSript
(124) -
Web Development
(3,002) -
Ask us Anything!
(66) -
Others
(1,938) -
Mobile Development
(263)
Subscribe to our Newsletter, and get personalized recommendations.
Already have an account? Sign in.
10 ответов
Я предполагаю, что вы используете virtualenv, который находится в том же каталоге, что и другие файлы проекта. Python должен точно знать этот путь. Таким образом, возможно, что Pycharm использует неверный интерпретатор.
Перейдите в Настройки → Проект: → Переводчик проекта → переключиться на правильный путь
В пакетах интерпретатора должен быть установлен пакет Django. Если нет, сделайте это здесь/в терминале.
Elisabeth Shevtsova
17 апр. 2017, в 17:53
Поделиться
Ответы частично отвечают частично.
Описание проблемы. У меня установлено несколько версий python, а Django — в одной из версий Python. Есть два вопроса
-
Проблема 1: У Pycharm есть неправильный интерпретатор python. Для этого
Project Interpreter
необходимо изменить на версию Python, где установлен Django. Решение. Следуйте всем шагам. -
Проблема 2: Django не указан как пакет. Для этого нам нужно сделать доступными установленные пакеты python в среде Pycharm. Решение. Следуйте всем шагам, кроме шага 3.
Решение:
Выполните следующие шаги.
- В настройках/настройках перейдите к
Project
>Project Interpreter
- В правой части нажмите
settings icon
>Add Local
- Выберите правильную версию Python из
Base Interpreter
- Отметьте флажок напротив
Inherit global site-packages
иMake available to all projects
- Нажмите
ok
Как только это будет сделано в Project Intepreter
, вы сможете увидеть Django
в списке пакетов.
Ayush Vatsyayan
17 март 2018, в 07:27
Поделиться
если вы успешно установили Django ранее, в другом месте, отличном от местоположения проекта: в pycharm перейдите к setting
> Project
> project interpreter
. В правой части окна «Интерпретатор проекта» щелкните значок настройки и выберите » add local
.
затем в Новой среде установите эти два флажка:
- наследовать глобальные пакеты сайтов
- сделать доступным для всех проектов
затем нажмите кнопку » Ok
и » Apply
и дождитесь установки переводчика в место вашего проекта.
Milad
17 дек. 2017, в 17:44
Поделиться
Если вы создаете проект, используйте python2.7, а в пути python2.7 вы установили django, проект работает нормально. Затем вы переключаете Project Interpreter на python3.5, но этот путь не установил django, тогда вы получите эту проблему.
aircraft
08 авг. 2017, в 10:04
Поделиться
У меня возникла эта проблема, и она остановила мои модульные тесты.
Я обнаружил, что PyCharm во время обновления установил мой Python Interpreter
на тот, который находился в виртуальной среде, которую я больше не использую для этого проекта. Поэтому я установил его в моей глобальной среде Python в C:Python
и все работает как шарм.
Надеюсь, это кому-нибудь поможет.
GrahamJ
29 март 2017, в 19:25
Поделиться
Вы можете сделать так, чтобы pyCharm распознал его, настроив его на использование вашей установки virtualenv, которая, как я полагаю, у вас уже была для проекта
ШАГ 1: открыть настройки PyCharm > Preferences
ШАГ 2. Найдите interpreter
и в правом окне выберите вашу виртуальную среду для использования в Project Interpreter
ШАГ 3 (ДОПОЛНИТЕЛЬНО): добавление вашей среды в список, если она не отображается
-
выберите Показать всех переводчиков, а затем во всплывающем окне нажмите значок + в левом нижнем углу
-
установите переключатель »
Existing Environment
выберите виртуальный env, а затем установите флажок «Сделать доступным для всех проектов», если вы используете env для другого проекта, и нажмите «ОК».
ШАГ 4: В окне настроек нажмите «Применить» или просто нажмите кнопку «ОК». подождите пару секунд и переменная django должна быть доступна в вашем проекте
Windo
22 дек. 2018, в 19:30
Поделиться
У меня тоже была эта пробема. Фактически я столкнулся с этой проблемой, потому что пакет django
не был установлен в Pycharm. Поэтому я пошел по этому пути и нажал на знак плюс, затем я искал django
и установил его. Это сработало хорошо.
file
> setting
> project
> project interpreter
M_Gh
02 июнь 2018, в 11:24
Поделиться
Пометить корневую папку проекта как ‘Sources root’, у меня это работает. Корень контента
Igor Z
22 янв. 2019, в 12:06
Поделиться
Я использовал virtualenv в своем проекте, и следующие шаги для меня работают.
Настройки → Проект: XXX → Интерпретатор проекта → щелкните значок справа рядом с переводчиком проекта → еще → выберите переводчика virtualenv
надеюсь, что это может помочь кому-то
user2228903
03 окт. 2018, в 03:25
Поделиться
Я исправляю эту проблему, изменяя «Структуру проекта». Попробуйте снять отметку с родительской папки как «Источники»
Melistraza
14 июнь 2018, в 11:48
Поделиться
Ещё вопросы
- 0AngularJS: of-repeat, of-if & JSON
- 0Удалить строку из таблицы
- 0Angularjs fullDate фильтр не работает
- 0Как выбрать родительский элемент и все дочерние элементы div, которые не являются первыми, а также братьев и сестер родителей и их детей?
- 0Показать все изображения из базы данных (php)
- 1Уровень доступа к базе данных ASP.NET MVC
- 1Связь с сервисом Android
- 0Как я могу узнать, сколько раз пятница 13-го появляется в году?
- 0Выравнивание div в середине не работает
- 0Как кодировать этот AngularJS скрыть кнопку при нажатии, а затем показать ее через 5 секунд
- 0динамически создавать наборы данных в flot
- 0Есть ли способ вручную принудительно обновить ионный сбор-повтор?
- 0Передайте класс javascript в php как json / альтернативный путь
- 1Как сделать всплывающую GUITexture?
- 0jQuery — ссылается на другой класс того же объекта
- 1почему response.redirect не может перенаправить страницу после истечения сеанса в global.aspx?
- 1Я не знаю, почему я получаю исключение за пределами границ?
- 1Создание библиотеки JAR с другими библиотеками
- 1Как загрузить Facebook Javascript SDK в Polymer Project?
- 1Как найти maven зависимости, которые не используются?
- 1RTSP live streaming не работает на Android 1.5 / 1.6?
- 0Как получить имя файла, который загружен во вложении, используя php
- 1Функция JavaScript Prime Checker с синтаксисом троичного оператора
- 0Неизвестный столбец при использовании псевдонима MySQL
- 0Должен ли я использовать JRE или JDK в Eclipse для разработки PHP?
- 0сбросить динамические символы в строке с помощью replace ()
- 0Разрыв строки после ключевого слова return в функции jQuery
- 1Удалите цвет фокуса по умолчанию из GridLayout и EditBox в Android
- 1Как написать функцию с наблюдаемой?
- 0Помехи при индексации таблиц при вставке в несколько таблиц
- 0Как отключить кнопку на Angular
- 0попробуйте удалить идентификатор iframe с запросом, в то время как нажмите как facebook
- 1Android: как добиться функциональности, как на фотографии в Facebook
- 1Преобразование строки, кодирующей трехмерный массив логических значений
- 0Выравнивание текста в верхнем правом углу ячейки таблицы без CSS?
- 1Как открыть всплывающее окно Combo Box в javafx
- 1Проблема, связанная с жизненным циклом деятельности
- 0Объедините шейдеры с DirectX 11
- 0Angularjs: фильтрация с использованием нескольких директив combobox для одного набора данных
- 0Использование фабрик с событиями на rootScope в angularjs
- 1Regex, который обрабатывает строки в кавычках и двойные кавычки для дюймов
- 0Цикл PHP For для $ _POST
- 0получить центр обнаруженного круга в изображении / opencv / c ++
- 0Как сделать так, чтобы MySQL возвращал самую низкую последнюю цену из столбца цен в нескольких таблицах
- 0MySQL вычисляет разницу между значениями, где не между x и y
- 0Как вставить автоматически увеличенный идентификатор поля mysql в php и обновить идентификатор одной таблицы в другую?
- 1System.Runtime.InteropServices.ExternalException при вызове Oracle.DataAccess.Client.OracleConnection.Open ()
- 1Редактирование сообщений с использованием discord.js не работает
- 0Условный интервал при наличии предупреждения
- 1OSError: [Errno 8] Ошибка формата Exec при запуске подпроцесса. Открыть