小编Abd*_*Abd的帖子

如何使用pipenv为python 2.7创建虚拟环境?

C:\\Users\\Abj>python\nPython 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 \nbit (AMD64)] on win32\nType "help", "copyright", "credits" or "license" for more information.\n>>> ^Z\n\nC:\\Users\\Abj>cd Documents\\VVV\\qq\\\n\nC:\\Users\\Abj\\Documents\\VVV\\qq>pipenv install django\nCreating a virtualenv for this project\xe2\x80\xa6\nPipfile: C:\\Users\\Abj\\Documents\\VVV\\qq\\Pipfile\nUsing c:\\python\\python37-32\\python.exe (3.7.2) to create virtualenv\xe2\x80\xa6\n[    ] Creating virtual environment...Already using interpreter \nc:\\python\\python37-32\\python.exe\nUsing base prefix \'c:\\\\python\\\\python37-32\'\nNew python executable in C:\\Users\\Abj\\.virtualenvs\\qq- \nbCTw3U33\\Scripts\\python.exe\nInstalling setuptools, pip, wheel...\ndone.\n\nSuccessfully created virtual environment!\nVirtualenv location: C:\\Users\\Abj\\.virtualenvs\\qq-bCTw3U33\nCreating a Pipfile for this project\xe2\x80\xa6\nInstalling django\xe2\x80\xa6\nAdding django to Pipfile\'s [packages]\xe2\x80\xa6\nInstallation Succeeded\nPipfile.lock not found, creating\xe2\x80\xa6\nLocking [dev-packages] dependencies\xe2\x80\xa6\nLocking [packages] dependencies\xe2\x80\xa6\nSuccess!\nUpdated Pipfile.lock (4f9dd2)!\nInstalling …
Run Code Online (Sandbox Code Playgroud)

python-2.7 python-3.x pipenv

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

程序在将字典传递给函数参数时显示TypeError

def f(**kwargs):
   print(kwargs)

d = {'0': 'a', '1': 'b', '2': 'c', '3': 'd'}   
f(**d)   # {'0': 'a', '1': 'b', '2': 'c', '3': 'd'}

d = {0: 'a', 1: 'b', 2: 'c', 3: 'd'}   
f(**d)   # TypeError: f() keywords must be strings
Run Code Online (Sandbox Code Playgroud)

在这里,我在将字典键值更改为int类型时获得TypeError.我可以知道,为什么我收到这个错误?

python python-3.x

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

标签 统计

python-3.x ×2

pipenv ×1

python ×1

python-2.7 ×1