python-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

Unable to import beautifulsoup in python

我怕爱的太早我们不能终老 提交于 2020-12-30 02:32:47
问题 I'm using Python.7.10 and have installed beautifulsoup using pip. The package was installed successfully. But when I'm trying to import beautifulsoup, I'm getting this error: ImportError: No module named beautifulsoup I checked the list of my installed modules and I found the beautifulsoup module in the installed modules list: 回答1: You installed BeautifulSoup version 3; the module is called BeautifulSoup with capital B and S : from BeautifulSoup import BeautifulSoup See the Quickstart

Unable to import beautifulsoup in python

这一生的挚爱 提交于 2020-12-30 02:29:53
问题 I'm using Python.7.10 and have installed beautifulsoup using pip. The package was installed successfully. But when I'm trying to import beautifulsoup, I'm getting this error: ImportError: No module named beautifulsoup I checked the list of my installed modules and I found the beautifulsoup module in the installed modules list: 回答1: You installed BeautifulSoup version 3; the module is called BeautifulSoup with capital B and S : from BeautifulSoup import BeautifulSoup See the Quickstart

Unable to import beautifulsoup in python

六眼飞鱼酱① 提交于 2020-12-30 02:27:46
问题 I'm using Python.7.10 and have installed beautifulsoup using pip. The package was installed successfully. But when I'm trying to import beautifulsoup, I'm getting this error: ImportError: No module named beautifulsoup I checked the list of my installed modules and I found the beautifulsoup module in the installed modules list: 回答1: You installed BeautifulSoup version 3; the module is called BeautifulSoup with capital B and S : from BeautifulSoup import BeautifulSoup See the Quickstart

Dynamically import module from memory in Python 3 using Hooks

混江龙づ霸主 提交于 2020-12-15 00:48:16
问题 What I want to achieve is exactly what this this answer proposes, however in Python 3. The code below works fine in Python 2: import sys import imp modules = { "my_module": """class Test: def __init__(self): self.x = 5 def print_number(self): print self.x"""} class StringImporter(object): def __init__(self, modules): self._modules = dict(modules) def find_module(self, fullname, path): if fullname in self._modules.keys(): return self return None def load_module(self, fullname): if not fullname

How to move all modules to new version of Python (from 3.6 to 3.7)

两盒软妹~` 提交于 2020-12-01 03:54:52
问题 I just upgraded to python 3.7 and I realized that all my modules stuck with the previous version. Even Django is not recognised anymore. How can I do to transfer everything to the new version? I am a little lost right now, don't even know where the new version has been installed. Edit: When I do $ which python3.6 the terminal tells me it doesn't exist, but I have a python3.6 directory in /usr/local/lib/ , where all modules are installed. In the same directory /usr/local/lib/ I also have a

How to move all modules to new version of Python (from 3.6 to 3.7)

亡梦爱人 提交于 2020-12-01 03:54:20
问题 I just upgraded to python 3.7 and I realized that all my modules stuck with the previous version. Even Django is not recognised anymore. How can I do to transfer everything to the new version? I am a little lost right now, don't even know where the new version has been installed. Edit: When I do $ which python3.6 the terminal tells me it doesn't exist, but I have a python3.6 directory in /usr/local/lib/ , where all modules are installed. In the same directory /usr/local/lib/ I also have a

How to move all modules to new version of Python (from 3.6 to 3.7)

本小妞迷上赌 提交于 2020-12-01 03:53:59
问题 I just upgraded to python 3.7 and I realized that all my modules stuck with the previous version. Even Django is not recognised anymore. How can I do to transfer everything to the new version? I am a little lost right now, don't even know where the new version has been installed. Edit: When I do $ which python3.6 the terminal tells me it doesn't exist, but I have a python3.6 directory in /usr/local/lib/ , where all modules are installed. In the same directory /usr/local/lib/ I also have a