0
有一個奇怪的問題。我將一個模塊(cherrypy)安裝到python venv中,但是我的腳本無法導入它。我安裝它的方式有問題嗎?python virtualenv安裝的軟件包無法導入
(venv)[[email protected] project]$ sudo python server.py
Traceback (most recent call last):
File "server.py", line 2, in <module>
import cherrypy
ImportError: No module named cherrypy
(venv)[[email protected] project]$ pip install cherrypy
Requirement already satisfied (use --upgrade to upgrade): cherrypy in ./venv/lib/python2.7/site-packages
你不應該用sudo來運行它。直接以'python server.py'運行 –