我創建了我的第一個包。當我嘗試在新創建的virtualenv中使用pip安裝它時,我收到一個錯誤,指出無法導入庫,但它們被添加到setup.py
的install_requires
字段中。如果我在vierualenv之外做的話,一切都好。 我setup.py是在這裏:https://github.com/tdi/pyPEPA/blob/dev/setup.pyPython包似乎無視我的要求
要重現錯誤:
mkvirtualenv something -p /usr/bin/python3
workon something
pip install pypepa
。
Downloading/unpacking pypepa
Running setup.py egg_info for package pypepa
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/home/tdi/.virtualenvs/koza/build/pypepa/setup.py", line 3, in <module>
import pypepa
File "./pypepa/__init__.py", line 6, in <module>
from pypepa.pepa_model import PEPAModel
File "./pypepa/pepa_model.py", line 6, in <module>
from pypepa.parsing.parser import PEPAParser
File "./pypepa/parsing/parser.py", line 5, in <module>
from pyparsing import Word, Literal, alphas, alphanums, nums, Combine, Optional, ZeroOrMore, Forward, restOfLine
ImportError: No module named 'pyparsing'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/home/tdi/.virtualenvs/koza/build/pypepa/setup.py", line 3, in <module>
import pypepa
File "./pypepa/__init__.py", line 6, in <module>
from pypepa.pepa_model import PEPAModel
File "./pypepa/pepa_model.py", line 6, in <module>
from pypepa.parsing.parser import PEPAParser
File "./pypepa/parsing/parser.py", line 5, in <module>
from pyparsing import Word, Literal, alphas, alphanums, nums, Combine, Optional, ZeroOrMore, Forward, restOfLine
ImportError: No module named 'pyparsing'
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/tdi/.virtualenvs/koza/build/pypepa
Storing complete log in /home/tdi/.pip/pip.log
爲什麼你使用'install_requires'而不是直接'require'? – brice
@brice好的謝謝你,我有點困惑它 – Darek