简体   繁体   中英

Python How to move script from windows to linux?

I created a python script by pycharm (I used several libraries). I want to use this script on a Linux server. How to do it? I tried with the PyInstaller but it generates .exe

PS Linux server is without Internet and PIP.

Thank you very much in advance

EDIT I read that is imposible and I should use WINE

It's unusual (but not unheard of) for your Linux server to be without an internet connection. (If you're doing secure batch processing, however, this might make sense.) Installing all of your script's dependant packages onto the server will be a bit tougher without internet access.

You'll need to find a packaged Python release, either in .rpm or .deb format (depending on your Linux distribution). Alternatively, you can compile it from source by downloading a package from the Python website and following the included compilation instructions.

You'll then probably need to get pip to install all of your Python dependencies into an isolated directory on a server which has an internet connection, as per this answer .

As for how you get these files onto the server, that will depend on your specific circumstances. If it's connected to an intranet, you could eg. use scp to get them from another Linux machine over ssh, or if you have physical access to the machine, a USB stick might do the trick. However, given that you've managed to get 'pyinstaller' onto the machine, you may already have this sussed.

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