小编dan*_*eia的帖子

安装mysql-python时出错:找不到-lssl的库

我在安装mysql-python时遇到问题.创建一个新的virtualenv,并在安装mysql-python时...这里是错误消息:

(env)$ pip install mysql-python
Collecting mysql-python
...

clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk build/temp.macosx-10.12-x86_64-2.7/_mysql.o -L/usr /local/Cellar/mysql/5.7.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.12-x86_64-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

使用自制软件,我安装了:

  • libressl
  • OpenSSL的
  • openssl@1.1
  • MySQL的

已经尝试brew link但酿造拒绝这样做.

操作系统是MacOS Sierra.

有人可以帮忙吗?谢谢!

homebrew pip virtualenv mysql-python

19
推荐指数
5
解决办法
9517
查看次数

使用空字段和空白字段创建 Django 表单

我正在尝试创建一个表单,其中两个字段都是可选的,但是在设置nullblank. 我究竟做错了什么?

错误

super(CharField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'blank'
Run Code Online (Sandbox Code Playgroud)

表格.py

class EditProfile(forms.Form):
    """
    A form that lets a user change their profile information
    """
        first_name = forms.CharField(
        label=("Fornavn"),
        strip=False,
        blank=True,
        null=True
    )
    last_name = forms.CharField(
        label=("Efternavn"),
        strip=False,
        blank=True,
        null=True,
    )
    def __init__(self, user, *args, **kwargs):
        self.user = user
        super().__init__(*args, **kwargs)

    def save(self, commit=True):
        first_name = self.cleaned_data["first_name"]
        last_name = self.cleaned_data["last_name"]
        self.user.first_name = first_name
        self.user.last_name = last_name
        if commit:
            self.user.save()
        return self.user
Run Code Online (Sandbox Code Playgroud)

python django

6
推荐指数
1
解决办法
3900
查看次数

django模型过滤字段的字段

我有这个模型:

class Article(models.Model):
    draft=models.BooleanField()
    public= models.IntegerField()

class PopularArticle(models.Model):
    article=models.ForeignKey(Article)
    priority= models.IntegerField()
Run Code Online (Sandbox Code Playgroud)

现在我想这样过滤:

PopularArticle.objects.filter(article.public=True,article.draft=False)
Run Code Online (Sandbox Code Playgroud)

换句话说,我想确保那些未处于草稿且已发表的热门文章。

我怎样才能做到这一点?

python django

2
推荐指数
1
解决办法
3175
查看次数

标签 统计

django ×2

python ×2

homebrew ×1

mysql-python ×1

pip ×1

virtualenv ×1