我安装了pipenvusing
$ pip3 install pipenv 
这给了我错误ImportError: cannot import name 'main'
以解决这个错误我按照这些指令
 sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall
现在pip3命令正在终端上工作。
现在我pipenv使用pip3 install pipenv
它安装成功安装但是当我尝试pipenv在终端上执行时它给了我pipenv: command not found  
在这一点上pip3也给了我 
 ImportError: cannot import name 'main' error 
为了解决这个问题我遵循了这些说明
PYTHON_BIN_PATH="$(python3 -m site --user-base)/bin"
PATH="$PATH:$PYTHON_BIN_PATH"
Run Code Online (Sandbox Code Playgroud)
此时, pointpipenv正在工作,但pip3没有工作。
我怎样才能让两者pip3同时pipenv工作?
此外,似乎我已经搞砸了我的 pipenv 设置,现在默认情况下/home/sysadmin
创建虚拟环境而不是我用来创建虚拟环境的位置/home/sysadmin/Desktop/helloworld
我发现自己陷入了处理 Django 模型选择字段和反应选择选项的困境。愿有人好心帮忙。这是我的模型代码:
class AccountType(models.Model):
    category = models.SmallIntegerField(
        choices=(
            (AccountCategories.ASSET, "Asset"),
            (AccountCategories.LIABILITY, "Liability"),
            (AccountCategories.EQUITY, "Equity"),
            (AccountCategories.REVENUE, "Revenue"),
            (AccountCategories.EXPENSE, "Operating Expense"),
        )
    )
    classification = models.SmallIntegerField(
        choices=(
            (AccountClassifications.NONE, ""),
            (AccountClassifications.CURRENT, "Current"),
            (AccountClassifications.NONCURRENT, "Long-Term"),
        )
    )
Run Code Online (Sandbox Code Playgroud)
我似乎无法弄清楚如何使这些选择成为我在 React 形式中的选择选项。我在想也许解决方案可能是在我的序列化器中验证或清理这些选择,但我坚持如何特别是与反应表单链接。提前致谢
我看了看,找不到类似的问题,可能是因为我是 python 菜鸟,不知道要搜索的正确语言。
有没有办法做到这一点...
frame_inds = [0,  list(range(200, 2000, 100)), 3999]
Run Code Online (Sandbox Code Playgroud)
我得到的输出是这个
[0, [200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900], 3999]
Run Code Online (Sandbox Code Playgroud)
但我想要这个
[0, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 3999]
Run Code Online (Sandbox Code Playgroud)
这样它都在一个数组中?
在matlab中你可以做到这一点 var1 = [1, 2, 3:10:100, 400]
我有一个字典,其中的值是来自作为字符串的键的几个子字符串的列表。例如:
d = {"How are things going": ["going","How"], "What the hell" : ["What", "hell"], "The police dept": ["dept","police"]}
Run Code Online (Sandbox Code Playgroud)
并且我想根据列表值在键中出现的位置获取从列表值生成的列表列表。例如在上面的案例中:
output = [["How", "going"], ["What", "hell"], ["police", "dept"]]
Run Code Online (Sandbox Code Playgroud)
我没有找到一种有效的方法来做到这一点,所以我使用了一种hacky方法:
final_output = []
for key,value in d.items():
    if len(value) > 1:
       new_list = []
       for item in value:
          new_list.append(item, key.find(item)) 
       
          new_list.sort(key = lambda x: x[1]) 
       ordered_list = [i[0] for i in new_list] 
       final_ouput.append(ordered_list)
     
Run Code Online (Sandbox Code Playgroud)