我正在将我的网站部署到heroku。在成功创建virtualenv之后,我在使用“pip install django-toolbelt”在这个virtualenv中安装django-toolbelt时遇到了问题。
起初,一切都很好,直到:
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 :(得分: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。