importerror

Python: import function from an already imported module

允我心安 提交于 2021-01-29 01:41:13
问题 Suppose I have a python package my_package which contains a module my_module which contains a function my_function . I was trying to do the following import in python interactive shell: >>> from my_package import my_module >>> my_module.my_function() # => OK >>> from my_module import my_function # => ImportError: No module named my_module >>> from my_package.my_module import my_function # => OK I am quite surprised at the ImportError at the third line above: since the my_module is already

Python: import function from an already imported module

守給你的承諾、 提交于 2021-01-29 01:40:42
问题 Suppose I have a python package my_package which contains a module my_module which contains a function my_function . I was trying to do the following import in python interactive shell: >>> from my_package import my_module >>> my_module.my_function() # => OK >>> from my_module import my_function # => ImportError: No module named my_module >>> from my_package.my_module import my_function # => OK I am quite surprised at the ImportError at the third line above: since the my_module is already

DLL load failed: The specified module could not be found while importing scipy

∥☆過路亽.° 提交于 2021-01-28 14:00:37
问题 I have installed python with Anaconda on windows 10. I have created a virtual environment with Anaconda called venv . After activating the environment, >>>python gives: Python 3.6.8 |Anaconda, Inc.| (default, Feb 11 2019, 15:03:47) [MSC v.1915 64 bit (AMD64)] on win32 I have installed scipy in my venv using pip: pip install scipy . I have set the interpreter in pycharm to the venv python interpreter. Now, I tried the following in a new module in pycharm: import scipy # No error here from

Conda ImportError: No module named conda.cli

不羁的心 提交于 2021-01-27 04:36:22
问题 I installed conda, not anaconda, directly onto a server I am working on using the following instructions wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh bash Miniconda2-latest-Linux-x86_64.sh install to $HOME/.miniconda2 edit ~/.bashrc Add this line: export PATH="$HOME/.miniconda2/bin:$PATH" source ~/.bashrc conda install pip When the conda installer asked me if I want to add the path to my .bashrc file I said yes and it added export PATH="/home/r/rhlozek/binesh

module importing itself

为君一笑 提交于 2021-01-23 06:19:12
问题 I'm trying to import a module from an application-specific terminal (Maya in this case, but eventually others). I've downloaded a project off git, and I have a structure like so: modulename submodule __init.py__ subsubmodule ... submodule ... __init.py__ modulename.py Then in my execution shell, I'm trying to import the module to use on the shell, so I have: import sys,os modulepath = 'C:/path/to/module' sys.path.append(modulepath) import modulename If the modulename.py being imported is

cannot import name 'mydb' from partially initialized module 'connection' in Python

跟風遠走 提交于 2021-01-21 06:39:48
问题 Python 3.8 error ImportError: cannot import name 'mydb' from partially initialized module 'connection' (most likely due to a circular import) (C:\U sers\Mark04\Documents\Python tutorial\databasing\connection.py) When I tried to execute child module select.py import bcrypt; from connection import mydb That has an imported module connection.py import mysql.connector mydb = "Success"; I dunno what is the problem, the error doesn't appear when I remove import mysql.connector from my module

cannot import name 'mydb' from partially initialized module 'connection' in Python

自闭症网瘾萝莉.ら 提交于 2021-01-21 06:36:34
问题 Python 3.8 error ImportError: cannot import name 'mydb' from partially initialized module 'connection' (most likely due to a circular import) (C:\U sers\Mark04\Documents\Python tutorial\databasing\connection.py) When I tried to execute child module select.py import bcrypt; from connection import mydb That has an imported module connection.py import mysql.connector mydb = "Success"; I dunno what is the problem, the error doesn't appear when I remove import mysql.connector from my module

Python - ModuleNotFoundError: No module named

半城伤御伤魂 提交于 2021-01-03 06:19:11
问题 I'm new in Python and I'm having the following error with this simple example: This is my project structure: python_project . ├── lib │ ├── __init__.py │ └── my_custom_lib.py └── src ├── __init__.py └── main.py And this is the error when I execute the src/main.py file: ☁ python_project python src/main.py Traceback (most recent call last): File "src/main.py", line 3, in <module> from lib import my_custom_lib ImportError: No module named lib If I move the main.py file to the root and then I

Python - ModuleNotFoundError: No module named

徘徊边缘 提交于 2021-01-03 06:18:13
问题 I'm new in Python and I'm having the following error with this simple example: This is my project structure: python_project . ├── lib │ ├── __init__.py │ └── my_custom_lib.py └── src ├── __init__.py └── main.py And this is the error when I execute the src/main.py file: ☁ python_project python src/main.py Traceback (most recent call last): File "src/main.py", line 3, in <module> from lib import my_custom_lib ImportError: No module named lib If I move the main.py file to the root and then I

Python - ModuleNotFoundError: No module named

夙愿已清 提交于 2021-01-03 06:16:19
问题 I'm new in Python and I'm having the following error with this simple example: This is my project structure: python_project . ├── lib │ ├── __init__.py │ └── my_custom_lib.py └── src ├── __init__.py └── main.py And this is the error when I execute the src/main.py file: ☁ python_project python src/main.py Traceback (most recent call last): File "src/main.py", line 3, in <module> from lib import my_custom_lib ImportError: No module named lib If I move the main.py file to the root and then I