2013-10-19 18 views
3

我正在將我的網站部署到heroku。在成功創建virtualenv之後,我在這個虛擬環境中使用「pip install django-toolbelt」安裝django-toolbelt時遇到了一個問題。安裝django-toolbelt時在static.py中的SyntaxError

起初,一切都很好,直到:

Running setup.py install for static 
     File "/home/administrator/env2/env2_env/lib/python3.2/site-packages/static.py", line 104 
     if full_path[-1] <> '/' or full_path == self.root: 
         ^
    SyntaxError: invalid syntax 


    Installing static script to /home/administrator/env2/env2_env/bin 
Successfully installed django-toolbelt django psycopg2 gunicorn dj-database-url dj-static static 
Cleaning up... 

我知道錯誤的原因是比較運算<>在python3.2無效。我關心的是安裝是否成功,儘管屏幕上的顯示是「成功安裝了django-toolbelt ...」。
如果不是,我該怎麼辦才能解決這個問題?謝謝。

+0

請接受將您的問題標記爲已解決的答案(這是一個社區wiki帖子,我不會獲得任何聲望,不要擔心:)) –

回答

0

我手動將操作員<>替換爲!=,並再次運行pip install django-toolbelt。然後用另一static.py文件出現了同樣的錯誤:

Running setup.py install for static 
     File "/usr/local/lib/python3.2/site-packages/static.py", line 104 
     if full_path[-1] <> '/' or full_path == self.root: 
         ^
    SyntaxError: invalid syntax 


    Installing static script to /usr/local/bin 
Successfully installed django-toolbelt gunicorn dj-database-url dj-static static 
Cleaning up... 

然後我在static.py文件再次改變操作<>!=。然後再次運行pip install django-toolbelt。現在沒有錯誤顯示:

Requirement already satisfied (use --upgrade to upgrade): django-toolbelt in /usr/local/lib/python3.2/site-packages 
Requirement already satisfied (use --upgrade to upgrade): django in /usr/local/lib/python3.2/site-packages (from django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /usr/local/lib/python3.2/site-packages (from django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): gunicorn in /usr/local/lib/python3.2/site-packages (from django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): dj-database-url in /usr/local/lib/python3.2/site-packages (from django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): dj-static in /usr/local/lib/python3.2/site-packages (from django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): static in /usr/local/lib/python3.2/site-packages (from dj-static->django-toolbelt) 
Requirement already satisfied (use --upgrade to upgrade): wsgiref in /usr/local/lib/python3.2 (from static->dj-static->django-toolbelt) 
Cleaning up... 

看起來確定。 static.py文件需要爲Python 3.2進行更新。

相關問題