Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python #83

Open
magicdawn opened this issue Jun 7, 2016 · 3 comments
Open

python #83

magicdawn opened this issue Jun 7, 2016 · 3 comments
Labels

Comments

@magicdawn
Copy link
Owner

No description provided.

@magicdawn
Copy link
Owner Author

pyenv

https://github.com/yyuu/pyenv

  1. ~/.pyenv/shims/ 加到 PATH 里, 然后运行一个 shims 里的 binary 时去动态选择 python version
  2. pyenv shell 3.5.1 设置了一个环境变量, 当前 shell 有效
  3. .python-version 文件里的, 可通过 pyenv local 3.5.1 设置
  4. pyenv global 2.7.11 全局

@magicdawn
Copy link
Owner Author

demos

modify apk

import zipfile
import os

home = os.environ['HOME']
apk_file = home + '/workspace/fengjr/android_pack/in-py.apk'

z = zipfile.ZipFile(apk_file, 'a')

meta_info_file = 'META-INF/in-py.txt'
exists = False

try:
    info = z.getinfo(meta_info_file)
    print(info)
    exists = True
except KeyError:
    exists = False

if exists:
    z.writestr(info, "From info")
else:
    z.writestr(meta_info_file, "From Python script")

z.close()

@magicdawn
Copy link
Owner Author

magicdawn commented Apr 26, 2022

pyenv / virtualenv / pyenv-virtualenv / 的关系

https://www.jianshu.com/p/857bf924cb65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant