python-3.7

Pyinstaller doesn't work in python 3.7 (can't find module 'encodings')

一笑奈何 提交于 2019-11-28 12:31:54
I have test program below - I compiled the code with pyinstaller (Python ver 3.7b. windows 10 - 64bit) noticed warnings during compilations and error. I would appreciate any insight to resolving this issue. Test.py import encodings print('Test') Sample of Compilations Warning 102 INFO: PyInstaller: 3.3.1 102 INFO: Python: 3.7.0b1 104 INFO: Platform: Windows-10-10.0.14393-SP0 2771 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\apps\python\python37\python.exe 2801 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\apps\python\python37\python.exe

How to change the python version of already existing virtualenv? [duplicate]

♀尐吖头ヾ 提交于 2019-11-28 11:26:32
This question already has an answer here: Can existing virtualenv be upgraded gracefully? 4 answers I have created a virtual environment using python 3.6, then I've made a system upgrade and I've got python 3.7 installed system wide. Now I can't execute python files in that virtual environment because it's searching for python 3.6. How can I upgrade the virtualenv python version to match the system wide version or how to downgrade the python version for that particular virtual environment? I'm using manjaro. See this link which explains it well. Virtualenvwrapper comes with some convenient

Fastest way to sort a python 3.7+ dictionary

久未见 提交于 2019-11-28 09:18:16
Now that the insertion order of Python dictionaries is guaranteed starting in Python 3.7 (and in CPython 3.6 ), what is the best/fastest way to sort a dictionary - both by value and by key? The most obvious way to do it is probably this: by_key = {k: dct[k] for k in sorted(dct.keys())} by_value = {k: dct[k] for k in sorted(dct.keys(), key=dct.__getitem__)} Are there alternative, faster ways to do this? Note that this question is not a duplicate since previous questions about how to sort a dictionary are out of date (to which the answer was, basically, You can't; use a collections.OrderedDict

update to python 3.7 using anaconda

ⅰ亾dé卋堺 提交于 2019-11-28 07:07:36
Python 3.7 alpha version is out, but I haven't been able to find any post on how to update to python 3.7 using Anaconda - maybe they will wait for the official release? Any suggestions? Python 3.7 is now available to be installed, but many packages have not been updated yet. As noted by another answer here , there is a GitHub issue tracking the progress of Anaconda building all the updated packages. Until someone creates a conda package for Python 3.7, you can't install it. Unfortunately, something like 3500 packages show up in a search for "python" on Anaconda.org ( https://anaconda.org

Django REST Framework CurrentUserDefault() with serializer

戏子无情 提交于 2019-11-28 00:16:47
I have been trying for a while now to add an 'owner' field to my models. I have looked at other questions but I still have had no luck. Ideally when a new note is created, the current user will be set in the owner field and won't be changeable. Below is my model, serializer, and view for a Note as far as I have gotten. I'm guessing the CurrentUserDefault() function needs additional context but I can't set it properly. views.py class NoteListCreateView(ListCreateAPIView): authentication_classes = (SessionAuthentication, TokenAuthentication) permission_classes = (DjangoModelPermissions,) lookup

What are data classes and how are they different from common classes?

╄→гoц情女王★ 提交于 2019-11-27 11:00:56
With PEP 557 data classes are introduced into python standard library. They make use of the @dataclass decorator and they are supposed to be "mutable namedtuples with default" but I'm not really sure I understand what this actually means and how they are different from common classes. What exactly are python data classes and when is it best to use them? Data classes are just regular classes that are geared towards storing state, more than contain a lot of logic. Every time you create a class that mostly consists of attributes you made a data class. What the dataclasses module does is make it

Class inheritance in Python 3.7 dataclasses

纵饮孤独 提交于 2019-11-27 10:19:11
问题 I'm currently trying my hands on the new dataclass constructions introduced in Python 3.7. I am currently stuck on trying to do some inheritance of a parent class. It looks like the order of the arguments are botched by my current approach such that the bool parameter in the child class is passed before the other parameters. This is causing a type error. from dataclasses import dataclass @dataclass class Parent: name: str age: int ugly: bool = False def print_name(self): print(self.name) def

Tweepy won't install on python 3.7; shows “syntax error”

怎甘沉沦 提交于 2019-11-27 08:07:16
问题 Before I begin, I'd like to preface that I'm relatively new to python, and haven't had to use it much before this little project of mine. I'm trying to make a twitter bot as part of an art project, and I can't seem to get tweepy to import. I'm using macOS High Sierra and Python 3.7. I first installed tweepy by using pip3 install tweepy and this appeared to work, as I'm able to find the tweepy files in finder. However, when I simply input import tweepy into the IDLE, I get this error:

Pyinstaller doesn't work in python 3.7 (can't find module 'encodings')

会有一股神秘感。 提交于 2019-11-27 07:02:09
问题 I have test program below - I compiled the code with pyinstaller (Python ver 3.7b. windows 10 - 64bit) noticed warnings during compilations and error. I would appreciate any insight to resolving this issue. Test.py import encodings print('Test') Sample of Compilations Warning 102 INFO: PyInstaller: 3.3.1 102 INFO: Python: 3.7.0b1 104 INFO: Platform: Windows-10-10.0.14393-SP0 2771 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\apps\python\python37\python.exe 2801

Fastest way to sort a python 3.7+ dictionary

左心房为你撑大大i 提交于 2019-11-27 02:15:53
问题 Now that the insertion order of Python dictionaries is guaranteed starting in Python 3.7 (and in CPython 3.6), what is the best/fastest way to sort a dictionary - both by value and by key? The most obvious way to do it is probably this: by_key = {k: dct[k] for k in sorted(dct.keys())} by_value = {k: dct[k] for k in sorted(dct.keys(), key=dct.__getitem__)} Are there alternative, faster ways to do this? Note that this question is not a duplicate since previous questions about how to sort a