简体   繁体   中英

Using virtualenv cross-platform (Linux and Windows) in Pycharm

I've created a virtualenv for my project on Linux and installed the packages I need just fine. When setting up my project in Pycharm, I can select the interpreter to use from venv/bin and Pycharm picks up all the packages in that virtualenv.

I also like to develop on a Windows machine, and I'd like to be able to use the same virtualenv I created on Linux when I clone it from git. However the interpreter created by Linux is a script that runs python3 ; this means I'd have to create a new Windows style virtualenv.

So my question is, is there a way I can create a venv that can be used cross platform?

A virtualenv is specific to the platform and location it was created on. You should not check it into version control. Each environment you develop in will have its own virtualenv. You make your package installable with setup.py , and/or specify requirements in requirements.txt in order to recreate the virtualenv.

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