ModuleNotFoundError:没有名为“ cherrypy”的模块

时间:2018-07-08 10:25:21

标签: python

我正在尝试在服务器中安装pgwatch2,在需要安装的许多东西中,它还包括安装一些pythong模块。

我正在使用python 3.6,我在本地安装了模块(下载了tar文件),并使用了下一条命令来安装模块:

pip3.6 install tar_file

当我确认所有内容均已安装时,我没有收到任何错误(第一个是cherrypy):

[webpy]# pip3.6 install -r requirements.txt 
Requirement already satisfied: cherrypy in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: jinja2 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: psycopg2 in /usr/local/lib64/python3.6/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: influxdb in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: decorator in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied: six>=1.11.0 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: cheroot>=6.2.4 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: portend>=2.1.1 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from jinja2->-r requirements.txt (line 2))
Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: requests>=2.17.0 in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: backports.functools_lru_cache in /usr/local/lib/python3.6/site-packages (from cheroot>=6.2.4->cherrypy->-r     requirements.txt (line 1))
Requirement already satisfied: more_itertools>=2.6 in /usr/local/lib/python3.6/site-packages (from cheroot>=6.2.4->cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: tempora>=1.8 in /usr/local/lib/python3.6/site-packages (from portend>=2.1.1->cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: jaraco.functools>=1.20 in /usr/local/lib/python3.6/site-packages (from tempora>=1.8->portend>=2.1.1->cherrypy->-r requirements.txt (line 1))

pip版本:

 pip3.6 --version
 pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)

但是,当我将python脚本作为安装步骤之一运行时,出现下一个错误:

[webpy]# python3.6 web.py 
Traceback (most recent call last):
  File "web.py", line 9, in <module>
    import cherrypy
ModuleNotFoundError: No module named 'cherrypy'

您知道我还能检查什么吗?

1 个答案:

答案 0 :(得分:1)

尝试以下操作以找出正在使用的Python安装python3.6

(base) C:\Users\felix>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\felix\\Anaconda3\\python.exe'

现在您可能会获得另一条路径,而不是pip使用/usr/lib/python3.6的路径。

有两种选择:

1。运行pip使用的python解释器

/usr/lib/python3.6 web.py

2。将软件包安装到python3.6

调用的python安装中

python3.6 -m pip install -r requirements.txt