简体   繁体   中英

How to run pipenv python as emacs Python shell

I use python-mode.el and have just discovered Pipenv . I can start Python within a project environment from a terminal by first changing to the project directory and entering "pipenv run python". But python-mode wants to execute a process, not a command string.

I tried creating a shell script like this:

#!/bin/bash
cd ~/myprojectdir
pipenv run python

but got this complaint

Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.

This variable is set in my terminal environment: how do i ensure it's set for pipenv? But the bigger question is, how do i run this pipenv virtual environment python inside emacs to get a buffer with a Python process?

pipenv.el在这里提供了帮助,通过设置适当的变量并在 Emacs 中的 Pipenv 周围提供一个瓷器。

Looks like i have to explicitly source my .bashrc file (or equivalent). Changing the contents of my runpipenv.sh script to this

#!/bin/bash
source ~/.bashrc
cd ~/myprojectdir
pipenv run python

(where my .bashrc file sets LANG ) and then calling

(setq py-shell-name "runpipenv.sh")

in Emacs seems to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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