简体   繁体   English

查找PYTHONPATH / env bitnami使用以及如何使用它

[英]Find the PYTHONPATH/env bitnami uses and how to use it

I've setup the one-click install of bitnami on Google Cloud. 我已经在Google Cloud上一键式安装了bitnami。 It's got Django 2.0 installed and that only works with python 3.x shown when I get out of a virtualenv I've created 它安装了Django 2.0,并且仅当我退出创建的virtualenv时,才与python 3.x一起使用

(djangoenv) bitnami@britecore-vm:/home/muiruri_samuel/apps/django$ cd ..
(djangoenv) bitnami@britecore-vm:/home/muiruri_samuel/apps$ deactivate
bitnami@britecore-vm:/home/muiruri_samuel/apps$ . /opt/bitnami/scripts/setenv.sh
bitnami@britecore-vm:/home/muiruri_samuel/apps$ python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
ImportError: No module named site
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] zipimport
# cleanup[1] signal
# cleanup[1] exceptions
# cleanup[1] _warnings
# cleanup sys
# cleanup __builtin__
# cleanup ints: 5 unfreed ints
# cleanup floats
bitnami@britecore-vm:/home/muiruri_samuel/apps$ python
ImportError: No module named site

I tried a snippet I saw on bitnami community on starting the env but it didn't work. 我尝试在bitnami社区上看到的一个片段启动了env,但是没有用。 I need to pip install a new package to where bitnami has it's packages so it can use it. 我需要在bitnami的软件包中安装一个新软件包,以便可以使用它。 I'm ok with just running my commands thereafter from the other virtualenv just incase it shows that would be easier. 之后,我可以从另一个virtualenv中运行命令,以防万一它显示起来会更容易。

Him I think the problem is that when you type "python" , you're using the Python installed on the system ( /usr/bin/python ). 他,我认为问题在于,当您键入“ python”时 ,您正在使用系统上安装的Python( /usr/bin/python )。 However, when you type "python3" you will be using included on the stack ( /opt/bitnami/python/bin/python3 ). 但是,当您键入“ python3”时 ,将使用包含在堆栈中的( /opt/bitnami/python/bin/python3 )。 You can check it by running: 您可以通过运行以下命令进行检查:

which python which python3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM