所以我在Windows 7 64位上安装了python 2.7.3,我希望对2.7.5版本进行增量升级.我安装了pip并且工作正常; 我刚刚使用它安装了Django.
我遇到了这个命令:pip install --upgrade'python> = 2.7,<2.7.99'
现在它迫使pip下载不是Python 3的最新版本,这就是我想要的.2.7.5开始下载,我收到以下错误:
Downloading/unpacking python>=2.7,<2.7.99
Downloading Python-2.7.5.tar.bz2 (12.1MB): 12.1MB downloaded
Running setup.py egg_info for package python
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "c:\users\name\appdata\local\temp\pip-build-name\python\setup.py", line 33, in <module>
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
TypeError: argument of type 'NoneType' is not iterable
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "c:\users\name\appdata\local\temp\pip-build-name\python\setup.py", line 33, in <module>
COMPILED_WITH_PYDEBUG …Run Code Online (Sandbox Code Playgroud) 考虑到:
class Parent(object):
def altered(self):
print "PARENT altered()"
class Child(Parent):
def altered(self):
print "CHILD, BEFORE PARENT altered()"
super(Child, self).altered() # what are the arguments needed? Why Child and self?
print "CHILD, AFTER PARENT altered()"
Run Code Online (Sandbox Code Playgroud)
在Python 2.7中,为什么必须Child作为参数传递给super()调用?使用超级而不仅仅是让它工作的确切错综复杂是什么.
克隆我的回购工作; 推回去没有.
第一次克隆不起作用:
git clone https://github.com/slimsnerdy/testy.git
Cloning into 'testy'...
fatal: unable to access 'https://github.com/slimsnerdy/testy.git/': SSL certificate problem: self signed certificate in
certificate chain
Run Code Online (Sandbox Code Playgroud)
所以我在.gitconfig文件中添加了以下自定义证书:
[http]
sslCAInfo = U:/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)
现在克隆工作:
Cloning into 'testy'...
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 25 (delta 8), reused 6 (delta 1), pack-reused 0
Unpacking objects: 100% (25/25), done.
Run Code Online (Sandbox Code Playgroud)
好了现在推动:
new-item test.txt
git add *
git commit -m "push test"
git push
Username for 'https://github.com': slimsnerdy
Password for …Run Code Online (Sandbox Code Playgroud) 将2个模型列入通用IndexView的SIMPLEST方法是什么?我的两个型号是CharacterSeries和CharacterUniverse.
我的views.py
from .models import CharacterSeries, CharacterUniverse
class IndexView(generic.ListView):
template_name = 'character/index.html'
context_object_name = 'character_series_list'
def get_queryset(self):
return CharacterSeries.objects.order_by('name')
class IndexView(generic.ListView):
template_name = 'character/index.html'
context_object_name = 'character_universe_list'
def get_queryset(self):
return CharacterUniverse.objects.order_by('name')
Run Code Online (Sandbox Code Playgroud)
我需要知道最短和最优雅的代码.看了很多,但不想使用mixins.我可能没有指出正确的方向.
谢谢大家.
我有这个代码:
double i;
while(cin >> i)
{
if ( i < 0.0)
cout << "ENTER A POSITIVE NUMBER: ";
else
break;
}
Run Code Online (Sandbox Code Playgroud)
我想要这样的代码(我不想使用break):
while((cin >> i) < 0.0)
{
cout << "ENTER A POSITIVE NUMBER: ";
}
Run Code Online (Sandbox Code Playgroud)
我在这一行上得到一个错误:while((cin >> i) < 0.0)说invalid operands to binary expression.
我错过了什么?
我有2个模型,IndexView使用该get_context_data方法可以正常工作。但是我DetailView使用相同的技术无法正常工作。我如何简单地将2个模型放入DetailView?
views.py
from .models import CharacterSeries, CharacterUniverse
class IndexView(generic.ListView):
template_name = 'character/index.html'
context_object_name = 'character_series_list'
def get_queryset(self):
return CharacterSeries.objects.order_by('name')
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context['character_universe_list'] = CharacterUniverse.objects.order_by('name')
return context
class DetailView(generic.DetailView):
model = CharacterSeries
template_name = 'character/detail.html'
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
context['character_universe_list'] = CharacterUniverse.objects.all()
return context
Run Code Online (Sandbox Code Playgroud)
我缺少一些东西;我需要CharacterUniverse进入DetailView。我尝试使用此页面的信息无济于事。
谢谢大家
更新:
detail.html
<ul>
{% for series in characterseries.character_set.all %}
<li>{{ series.name }}</li>
{% endfor %} …Run Code Online (Sandbox Code Playgroud) 我有这个代码:
void FeetInches::decimal()
{
if (inches == 6.0)
{
inches = 5;
std::cout << feet << "." << inches << " feet"; //not the best but works..
}
}
Run Code Online (Sandbox Code Playgroud)
这将打印12英尺6英寸,12.5英尺.我宁愿不使用这种"hackish"方法,并使它像这样:
void FeetInches::decimal()
{
if (inches == 6.0)
{
inches = .5;
std::cout << feet << inches << " feet"; //not the best but works..
}
}
Run Code Online (Sandbox Code Playgroud)
但这将打印60.5英寸(我需要6.5英寸).基本上如果我单独打印英寸它打印0.5.我想要英寸只打印.5没有零.不能用printf方法或其他快速技术实现这个吗?顺便说一下,数据类型是双重的
所以我使用Windows 7 64位上的默认安装程序设置安装了postgreSQL版本9.2.4.然后我启动了SQL Shell(psql)命令行工具并输入所有默认值以及我在安装过程中使用的密码.它登录.问题是无法创建数据库,或者它出现.
我输入了creatdb mydb
还尝试了CREATE DATABASE mydb
我假设发生了一些事情,但是当我输入\ list时,我只看到默认安装的数据库.
我在这里错过了什么吗?来自MySQL,这个简单的任务令人费解.没有错误,没有.
c++ ×2
django ×2
django-views ×2
python ×2
git ×1
github ×1
inheritance ×1
pip ×1
postgresql ×1
upgrade ×1
while-loop ×1