我是新來的simpy我用的easy_install安裝的SimPy模塊,然後在命令行中,我只是試圖from SimPy.Simulation import *
上,但我得到以下錯誤無法導入的SimPy
Python 2.6.7 (r267:88850, Aug 22 2011, 14:13:38)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from SymPy.Simulation import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named SymPy.Simulation
我用easy_install的安裝包,我有simplejson安裝沒有任何問題,當我導入simplejson我沒有得到上述錯誤。我做了一個更新和easy_install的成功更新SymPy模塊但我仍然不能導入的SimPy模塊
[/Library/Python/2.6/site-packages]$easy_install -U SimPy
Searching for SimPy
Reading http://pypi.python.org/simple/SimPy/
Reading http://SimPy.SourceForge.net
Reading http://simpy.sourceforge.net/
Reading https://sourceforge.net/projects/simpy/files/
Reading http://pypi.python.org/simple/SimPy/simpy.sourceforge.net
Reading http://sourceforge.net/project/showfiles.php?group_id=62366
Best match: SimPy 2.2
Processing SimPy-2.2-py2.6.egg
SimPy 2.2 is already the active version in easy-install.pth
Using /Library/Python/2.6/site-packages/SimPy-2.2-py2.6.egg
Processing dependencies for SimPy
Finished processing dependencies for SimPy
我還檢查easy-install.pth
文件,看起來一切都已經正確添加。
[/Library/Python/2.6/site-packages]$more easy-install.pth
import sys; sys.__plen = len(sys.path)
./simplejson-2.1.3-py2.6.egg
./SimPy-2.2-py2.6.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
這將是偉大的,如果我能得到任何幫助。
Best; NH
你要導入的SimPy或SymPy?你在你給的例子中都用到了。如果您使用SymPy,請注意Python解釋器區分大小寫,正確的包名稱爲「sympy」。 – VPeric
所以......它是'sympy'還是'SymPy'或'SimPy'或'simpy'?因爲這些都是不同的...... – agf